pub struct Theme {Show 18 fields
pub background: Color32,
pub surface: Color32,
pub surface_raised: Color32,
pub sunken: Color32,
pub text: Color32,
pub text_muted: Color32,
pub accent: Color32,
pub accent_text: Color32,
pub border: Color32,
pub selection: Color32,
pub hover: Color32,
pub danger: Color32,
pub warning: Color32,
pub success: Color32,
pub done: Color32,
pub link: Color32,
pub scrollbar: Color32,
pub focus: Color32,
}Expand description
The color tokens of one theme.
Fields§
§background: Color32Window, editor, and panel background (visuals.panel_fill).
surface: Color32Raised chrome: menus, dialogs, the sidebar, the tab strip (visuals.window_fill).
surface_raised: Color32A second raised surface for cards.
sunken: Color32Sunken surfaces: text fields, steppers, segmented controls (extreme_bg_color).
text: Color32Primary text.
text_muted: Color32Secondary text: hints, descriptions, inactive tabs.
accent: Color32Brand accent.
accent_text: Color32Text drawn on the accent.
border: Color32Borders and separators.
selection: Color32Selection background: selected rows, active segments, primary buttons.
hover: Color32Hover background for rows and icon buttons.
danger: Color32Errors and destructive actions.
warning: Color32Warnings and conflict banners.
success: Color32Success messages.
done: Color32“Done” purple.
link: Color32Hyperlinks.
scrollbar: Color32Scrollbar handle.
focus: Color32Keyboard focus ring, hovered borders, and the active-row marker.
Implementations§
Source§impl Theme
impl Theme
Sourcepub fn with_accent(self, accent: Color32) -> Theme
pub fn with_accent(self, accent: Color32) -> Theme
The same tokens with a new brand color, derived exactly as in the core.
Sourcepub fn accessibility_issues(&self) -> Vec<(&'static str, f32)>
pub fn accessibility_issues(&self) -> Vec<(&'static str, f32)>
The pairs that miss WCAG AA, with their ratio.
Sourcepub fn border_stroke(&self) -> Stroke
pub fn border_stroke(&self) -> Stroke
The 1 px border stroke.
Sourcepub fn high_contrast(self) -> Theme
pub fn high_contrast(self) -> Theme
A high-contrast variant, computed by the core.
Sourcepub fn to_css_variables(&self) -> String
pub fn to_css_variables(&self) -> String
The theme as #rrggbb CSS custom properties.
Sourcepub fn from_vscode_json(text: &str) -> Result<Theme, ThemeImportError>
Available on crate feature serde only.
pub fn from_vscode_json(text: &str) -> Result<Theme, ThemeImportError>
serde only.Import a VS Code color theme.
§Errors
When the JSON is malformed or lacks editor.background and foreground.
Trait Implementations§
impl Copy for Theme
Source§impl<'de> Deserialize<'de> for Theme
impl<'de> Deserialize<'de> for Theme
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Theme, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Theme, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for Theme
Source§impl Serialize for Theme
impl Serialize for Theme
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Theme
Auto Trait Implementations§
impl Forget for Theme
impl Freeze for Theme
impl Move for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Theme
impl UnwindSafe for Theme
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more