Skip to main content

Palette

Struct Palette 

Source
pub struct Palette;
Expand description

Basic 16-color palette — SGR 30-37/90-97 only, no truecolor RGB.

Why 16 colors: truecolor RGB renders the same pixel regardless of terminal theme. On Mac Terminal.app’s default “Basic” (light) profile, our old lavender/mint/grays landed on a light background and all but disappeared. The 16-color SGR palette (30-37, 90-97) is interpreted by the terminal’s own theme engine — each user’s colorscheme remaps the same escape into theme-appropriate RGB, so atomcode adapts to whatever terminal theme the user runs.

Compatibility floor: SGR 30-37/90-97 are part of the 1996 ECMA-48 baseline. Every modern terminal (macOS Terminal, iTerm2, Alacritty, Kitty, Wezterm, Windows Terminal, Win10 1511+ cmd.exe with VT mode, tmux, SSH-in-SSH) handles them identically. We specifically avoid \x1b[2m (dim) which isn’t reliable on Windows conhost < 1809.

Implementations§

Source§

impl Palette

Source

pub const BRAND: Color = Color::Magenta

Source

pub const MUTED_LIGHT: Color = Color::DarkGrey

Muted text on light backgrounds. SGR 90 (“bright black”) maps to a mid-gray on most light themes — contrast against #FFFFFF lands around 4.5–5:1, comfortably above AA.

Source

pub const MUTED_DARK: Color = Color::White

Muted text on dark backgrounds. SGR 37 (“regular white”) maps to a soft light-gray on dark themes — contrast against #1B1B1B to #303030 lands around 8–10:1.

Earlier this was Color::DarkGrey (SGR 90) for both modes on the theory that the terminal’s palette would adapt. Reality from Warp / iTerm2 / Mac Terminal screenshots: most dark themes map SGR 90 to ~#3F3F3F (≈ 3:1 against the dark bg) — child rows under a tool-batch header rendered almost invisible. Splitting MUTED into light/dark variants and switching via is_light_for_render recovers readable contrast on both.

Source

pub const MUTED: Color = Self::MUTED_LIGHT

Back-compat alias — same value as MUTED_LIGHT so old call sites that pre-date the dark-mode split keep compiling. New code should call muted_for_current_theme instead so the shade tracks the active palette.

Source

pub const ACCENT: Color = Color::Cyan

Source

pub const BORDER: Color = Color::Cyan

Source

pub const WARNING: Color = Color::Yellow

Source

pub const ERROR: Color = Color::Red

Source

pub const DIFF_ADD: Color = Color::Green

Source

pub const DIFF_REMOVE: Color = Color::Red

Source

pub const CODE: Color = Color::Cyan

Auto Trait Implementations§

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> 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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
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