Skip to main content

RenderItem

Enum RenderItem 

Source
pub enum RenderItem {
Show 16 variants Text(String), Icon(String), Foreground(Color), ForegroundAnsi(AnsiColor), Background(Color), BackgroundAnsi(AnsiColor), Bold, Italic, Underline(UnderlineStyle), Strikethrough, ResetAttributes, ResetForeground, ResetBackground, Spacer, Padding(u8), Separator(String),
}
Expand description

A single rendering element for status bar content

RenderItems are processed sequentially to build styled text for the status bar. They can represent text content, color changes, text attributes, or layout elements.

Variants§

§

Text(String)

Display text content

Renders the provided string with the current text style.

§Example

use scarab_plugin_api::status_bar::RenderItem;

let item = RenderItem::Text("Hello, World!".to_string());
§

Icon(String)

Display a Nerd Font icon

Renders an icon from the Nerd Font icon set by name. The icon will use the current foreground color and attributes.

§Example

use scarab_plugin_api::status_bar::RenderItem;

let item = RenderItem::Icon("nf-fa-battery_full".to_string());
§

Foreground(Color)

Set foreground (text) color

Changes the text color for all subsequent text items until another color change or reset.

§Example

use scarab_plugin_api::status_bar::{RenderItem, Color};

let item = RenderItem::Foreground(Color::Rgb(122, 162, 247));
§

ForegroundAnsi(AnsiColor)

Set foreground color using ANSI color

Alternative to Foreground using standard ANSI color names.

§Example

use scarab_plugin_api::status_bar::{RenderItem, AnsiColor};

let item = RenderItem::ForegroundAnsi(AnsiColor::BrightBlue);
§

Background(Color)

Set background color

Changes the background color for all subsequent text items.

§Example

use scarab_plugin_api::status_bar::{RenderItem, Color};

let item = RenderItem::Background(Color::Named("darkgray".to_string()));
§

BackgroundAnsi(AnsiColor)

Set background color using ANSI color

Alternative to Background using standard ANSI color names.

§Example

use scarab_plugin_api::status_bar::{RenderItem, AnsiColor};

let item = RenderItem::BackgroundAnsi(AnsiColor::Black);
§

Bold

Enable bold text attribute

Makes all subsequent text bold until reset or another weight change.

§Example

use scarab_plugin_api::status_bar::RenderItem;

let items = vec![
    RenderItem::Bold,
    RenderItem::Text("Important".to_string()),
];
§

Italic

Enable italic text attribute

Makes all subsequent text italic until reset.

§Example

use scarab_plugin_api::status_bar::RenderItem;

let items = vec![
    RenderItem::Italic,
    RenderItem::Text("Emphasis".to_string()),
];
§

Underline(UnderlineStyle)

Enable underline with specified style

Underlines all subsequent text with the given style until reset.

§Example

use scarab_plugin_api::status_bar::{RenderItem, UnderlineStyle};

let items = vec![
    RenderItem::Underline(UnderlineStyle::Curly),
    RenderItem::Text("Warning".to_string()),
];
§

Strikethrough

Enable strikethrough text attribute

Strikes through all subsequent text until reset.

§Example

use scarab_plugin_api::status_bar::RenderItem;

let items = vec![
    RenderItem::Strikethrough,
    RenderItem::Text("Deprecated".to_string()),
];
§

ResetAttributes

Reset all text attributes to defaults

Clears all colors, bold, italic, underline, and strikethrough attributes.

§Example

use scarab_plugin_api::status_bar::RenderItem;

let items = vec![
    RenderItem::Bold,
    RenderItem::Text("Bold".to_string()),
    RenderItem::ResetAttributes,
    RenderItem::Text("Normal".to_string()),
];
§

ResetForeground

Reset foreground color to default

Clears only the foreground color, keeping other attributes.

§Example

use scarab_plugin_api::status_bar::{RenderItem, Color};

let items = vec![
    RenderItem::Bold,
    RenderItem::Foreground(Color::Hex("#ff0000".to_string())),
    RenderItem::Text("Red & Bold".to_string()),
    RenderItem::ResetForeground,
    RenderItem::Text("Default color, still bold".to_string()),
];
§

ResetBackground

Reset background color to default

Clears only the background color, keeping other attributes.

§Example

use scarab_plugin_api::status_bar::{RenderItem, Color};

let items = vec![
    RenderItem::Background(Color::Hex("#333333".to_string())),
    RenderItem::Text("Dark background".to_string()),
    RenderItem::ResetBackground,
    RenderItem::Text("Default background".to_string()),
];
§

Spacer

Insert flexible spacing

Creates space that expands to fill available room. Useful for pushing content to opposite ends of the status bar.

§Example

use scarab_plugin_api::status_bar::RenderItem;

let items = vec![
    RenderItem::Text("Left".to_string()),
    RenderItem::Spacer,
    RenderItem::Text("Right".to_string()),
];
§

Padding(u8)

Insert fixed spacing

Adds a fixed number of space characters (cells).

§Example

use scarab_plugin_api::status_bar::RenderItem;

let items = vec![
    RenderItem::Text("A".to_string()),
    RenderItem::Padding(3),
    RenderItem::Text("B".to_string()),
];
§

Separator(String)

Insert a separator string

Convenience item for common separators like “ | “ or “ • “.

§Example

use scarab_plugin_api::status_bar::RenderItem;

let items = vec![
    RenderItem::Text("Section 1".to_string()),
    RenderItem::Separator(" | ".to_string()),
    RenderItem::Text("Section 2".to_string()),
];

Trait Implementations§

Source§

impl Clone for RenderItem

Source§

fn clone(&self) -> RenderItem

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 RenderItem

Source§

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

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

impl<'de> Deserialize<'de> for RenderItem

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for RenderItem

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,