Skip to main content

Theme

Struct Theme 

Source
pub struct Theme {
Show 22 fields pub success: ThemeColor, pub error: ThemeColor, pub warning: ThemeColor, pub info: ThemeColor, pub null_value: ThemeColor, pub bool_value: ThemeColor, pub number_value: ThemeColor, pub string_value: ThemeColor, pub date_value: ThemeColor, pub binary_value: ThemeColor, pub json_value: ThemeColor, pub uuid_value: ThemeColor, pub sql_keyword: ThemeColor, pub sql_string: ThemeColor, pub sql_number: ThemeColor, pub sql_comment: ThemeColor, pub sql_operator: ThemeColor, pub sql_identifier: ThemeColor, pub border: ThemeColor, pub header: ThemeColor, pub dim: ThemeColor, pub highlight: ThemeColor,
}
Expand description

SQLModel console theme with semantic colors.

Defines all colors used throughout SQLModel console output. Use Theme::dark() or Theme::light() for predefined themes, or customize individual colors.

§Example

use sqlmodel_console::Theme;

let theme = Theme::dark();
assert_eq!(theme.success.rgb(), (80, 250, 123));

Fields§

§success: ThemeColor

Success messages, completion indicators (green).

§error: ThemeColor

Error messages, failure indicators (red).

§warning: ThemeColor

Warning messages, deprecation notices (yellow).

§info: ThemeColor

Informational messages, hints (cyan).

§null_value: ThemeColor

NULL values (typically dim/italic).

§bool_value: ThemeColor

Boolean values (true/false).

§number_value: ThemeColor

Numeric values (integers, floats).

§string_value: ThemeColor

String/text values.

§date_value: ThemeColor

Date/time/timestamp values.

§binary_value: ThemeColor

Binary/blob values.

§json_value: ThemeColor

JSON values.

§uuid_value: ThemeColor

UUID values.

§sql_keyword: ThemeColor

SQL keywords (SELECT, FROM, WHERE).

§sql_string: ThemeColor

SQL strings (‘value’).

§sql_number: ThemeColor

SQL numbers (42, 3.14).

§sql_comment: ThemeColor

SQL comments (– comment).

§sql_operator: ThemeColor

SQL operators (=, >, AND).

§sql_identifier: ThemeColor

SQL identifiers (table names, column names).

§border: ThemeColor

Table/panel borders.

§header: ThemeColor

Headers and titles.

§dim: ThemeColor

Dimmed/secondary text.

§highlight: ThemeColor

Highlighted/emphasized text.

Implementations§

Source§

impl Theme

Source

pub fn dark() -> Self

Create the default dark theme (Dracula-inspired).

This theme is optimized for dark terminal backgrounds and uses the Dracula color palette for high contrast and visual appeal.

§Example
use sqlmodel_console::Theme;

let theme = Theme::dark();
Source

pub fn light() -> Self

Create a light theme variant.

This theme is optimized for light terminal backgrounds with darker colors for better visibility.

§Example
use sqlmodel_console::Theme;

let theme = Theme::light();
Source

pub fn new() -> Self

Create a new theme by cloning an existing one.

Useful for customizing a preset theme.

§Example
use sqlmodel_console::Theme;
use sqlmodel_console::theme::ThemeColor;

let mut theme = Theme::dark();
theme.success = ThemeColor::new((0, 255, 0), 46); // Brighter green

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Theme

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Theme

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze 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> 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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.