Skip to main content

Style

Struct Style 

Source
pub struct Style {
Show 21 fields pub background: Color, pub text_color: Color, pub gutter_background: Color, pub gutter_border: Color, pub line_number_color: Color, pub scrollbar_background: Color, pub scroller_color: Color, pub current_line_highlight: Color, pub whitespace_color: Color, pub indent_guide_color: Color, pub search_match_color: Color, pub search_match_current_color: Color, pub selection_color: Color, pub bracket_match_color: Color, pub ime_preedit_background_color: Color, pub syntax_theme_name: Option<&'static str>, pub token_colors: TokenColors, pub diagnostic_error_color: Color, pub diagnostic_warning_color: Color, pub diagnostic_information_color: Color, pub diagnostic_hint_color: Color,
}
Expand description

The appearance of a code editor.

Build one with from_iced_theme to follow the application’s Iced theme, then override individual fields for anything that needs to differ.

§Examples

use iced_code_editor::{CodeEditor, theme};

let mut style = theme::from_iced_theme(&iced::Theme::TokyoNightStorm);

// Tweak one color while keeping the rest of the derived palette.
style.current_line_highlight = iced::Color::from_rgba(1.0, 1.0, 1.0, 0.05);

let mut editor = CodeEditor::new("fn main() {}", "rs");
editor.set_theme(style);

Fields§

§background: Color

Main editor background color

§text_color: Color

Text content color

§gutter_background: Color

Line numbers gutter background color

§gutter_border: Color

Border color for the gutter

§line_number_color: Color

Color for line numbers text

§scrollbar_background: Color

Scrollbar background color

§scroller_color: Color

Scrollbar scroller (thumb) color

§current_line_highlight: Color

Highlight color for the current line where cursor is located

§whitespace_color: Color

Color for visible whitespace characters (spaces as ·, tabs as →)

§indent_guide_color: Color

Color of the vertical indentation guides drawn behind the text

§search_match_color: Color

Highlight fill color for non-current search matches

§search_match_current_color: Color

Highlight fill color for the currently active search match

§selection_color: Color

Fill color for text selection ranges

§bracket_match_color: Color

Fill color used to highlight a matching bracket pair

§ime_preedit_background_color: Color

Background fill color for the IME preedit (composition) region

§syntax_theme_name: Option<&'static str>

Name of the syntect theme that colors the code tokens.

Any theme bundled with syntect works: "base16-ocean.dark", "base16-eighties.dark", "base16-mocha.dark", "base16-ocean.light", "InspiredGitHub", "Solarized (dark)" and "Solarized (light)". None, or an unknown name, picks base16-ocean in its dark or light variant from the lightness of Style::background.

§token_colors: TokenColors

Colors drawn over the syntax theme for common token kinds, matched by TextMate scope. The default overrides nothing.

§diagnostic_error_color: Color

Underline color for error diagnostics

§diagnostic_warning_color: Color

Underline color for warning diagnostics

§diagnostic_information_color: Color

Underline color for information diagnostics

§diagnostic_hint_color: Color

Underline color for hint diagnostics

Trait Implementations§

Source§

impl Clone for Style

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Style

Source§

impl Debug for Style

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Style

§

impl Freeze for Style

§

impl Move for Style

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnsafeUnpin for Style

§

impl UnwindSafe for Style

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<State, Message> IntoBoot<State, Message> for State

Source§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<T> MaybeClone for T

Source§

impl<T> MaybeDebug for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more