Skip to main content

Form

Struct Form 

Source
pub struct Form {
    pub style: ContentStyle,
    /* private fields */
}
Expand description

A style for text.

Fields§

§style: ContentStyle

The actual style that is applied

Implementations§

Source§

impl Form

Source

pub const fn bold(self) -> Form

New Form with the bold attribute.

Source

pub const fn dim(self) -> Form

New Form with the dim attribute.

Source

pub const fn italic(self) -> Form

New Form with the italic attribute.

Source

pub const fn underlined(self) -> Form

New Form with the underlined attribute.

Source

pub const fn double_underlined(self) -> Form

New Form with the double_underlined attribute.

Source

pub const fn undercurled(self) -> Form

New Form with the undercurled attribute.

Source

pub const fn underdashed(self) -> Form

New Form with the underdashed attribute.

Source

pub const fn reverse(self) -> Form

New Form with the reverse attribute.

Source

pub const fn crossed_out(self) -> Form

New Form with the crossed_out attribute.

Source

pub const fn black(self) -> Form

New Form with a black foreground.

Source

pub const fn on_black(self) -> Form

New Form with a black background.

Source

pub const fn underline_black(self) -> Form

New Form with a black underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn dark_grey(self) -> Form

New Form with a dark_grey foreground.

Source

pub const fn on_dark_grey(self) -> Form

New Form with a dark_grey background.

Source

pub const fn underline_dark_grey(self) -> Form

New Form with a dark_grey underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn red(self) -> Form

New Form with a red foreground.

Source

pub const fn on_red(self) -> Form

New Form with a red background.

Source

pub const fn underline_red(self) -> Form

New Form with a red underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn dark_red(self) -> Form

New Form with a dark_red foreground.

Source

pub const fn on_dark_red(self) -> Form

New Form with a dark_red background.

Source

pub const fn underline_dark_red(self) -> Form

New Form with a dark_red underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn green(self) -> Form

New Form with a green foreground.

Source

pub const fn on_green(self) -> Form

New Form with a green background.

Source

pub const fn underline_green(self) -> Form

New Form with a green underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn dark_green(self) -> Form

New Form with a dark_green foreground.

Source

pub const fn on_dark_green(self) -> Form

New Form with a dark_green background.

Source

pub const fn underline_dark_green(self) -> Form

New Form with a dark_green underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn yellow(self) -> Form

New Form with a yellow foreground.

Source

pub const fn on_yellow(self) -> Form

New Form with a yellow background.

Source

pub const fn underline_yellow(self) -> Form

New Form with a yellow underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn dark_yellow(self) -> Form

New Form with a dark_yellow foreground.

Source

pub const fn on_dark_yellow(self) -> Form

New Form with a dark_yellow background.

Source

pub const fn underline_dark_yellow(self) -> Form

New Form with a dark_yellow underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn blue(self) -> Form

New Form with a blue foreground.

Source

pub const fn on_blue(self) -> Form

New Form with a blue background.

Source

pub const fn underline_blue(self) -> Form

New Form with a blue underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn dark_blue(self) -> Form

New Form with a dark_blue foreground.

Source

pub const fn on_dark_blue(self) -> Form

New Form with a dark_blue background.

Source

pub const fn underline_dark_blue(self) -> Form

New Form with a dark_blue underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn magenta(self) -> Form

New Form with a magenta foreground.

Source

pub const fn on_magenta(self) -> Form

New Form with a magenta background.

Source

pub const fn underline_magenta(self) -> Form

New Form with a magenta underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn dark_magenta(self) -> Form

New Form with a dark_magenta foreground.

Source

pub const fn on_dark_magenta(self) -> Form

New Form with a dark_magenta background.

Source

pub const fn underline_dark_magenta(self) -> Form

New Form with a dark_magenta underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn cyan(self) -> Form

New Form with a cyan foreground.

Source

pub const fn on_cyan(self) -> Form

New Form with a cyan background.

Source

pub const fn underline_cyan(self) -> Form

New Form with a cyan underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn dark_cyan(self) -> Form

New Form with a dark_cyan foreground.

Source

pub const fn on_dark_cyan(self) -> Form

New Form with a dark_cyan background.

Source

pub const fn underline_dark_cyan(self) -> Form

New Form with a dark_cyan underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn white(self) -> Form

New Form with a white foreground.

Source

pub const fn on_white(self) -> Form

New Form with a white background.

Source

pub const fn underline_white(self) -> Form

New Form with a white underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source

pub const fn grey(self) -> Form

New Form with a grey foreground.

Source

pub const fn on_grey(self) -> Form

New Form with a grey background.

Source

pub const fn underline_grey(self) -> Form

New Form with a grey underlining.

Do note that this feature may not be supported in all Uis, for example, various terminals don’t support this feature, since it is a part of the kitty protocol, and hasn’t been universally accepted yet.

Ui: crate::ui::traits::RawUi

Source§

impl Form

Source

pub const fn new() -> Form

Returns a new Form with a default style.

Source

pub fn of(form_name: impl AsRef<str>) -> Form

A Form value, from the name of the form.

Source

pub fn mimic(form_name: impl AsRef<str>) -> Form

A Form that mimics another.

This is useful if you want Forms to automatically change if the mimicked one does.

Normally, this is done automatically. For example, if you define a Form “foo.bar.baz” through form::id_of!, or within the txt! macro, then that Form will be set to “mimic” “foo.bar”. That is, if “foo.bar” changes, so will “foo.bar.baz”.

This function lets you manually do that.

Source

pub const fn reset(self) -> Form

Sets the Reset attribute.

In Duat, the Reset attribute should remove only other Attributes, not any of the colors in use.

Source

pub const fn with(self, color: &str) -> Form

Sets the color of the foreground.

This function accepts two color formats:

  • A hexcode, like "#abcdef", capitalization is ignored;
  • Three hsl values, like "hsl {hue} {sat} {lit}", where {hue}, {sat} and {lit} can either be a number from 0..255, or a percentage, followed by '%', e.g. "hsl 234 50% 42".

If this Form was created via Form::mimic, then the other attributes will change as the mimicked color does, but the foreground won’t.

Source

pub const fn on(self, color: &str) -> Form

New Form with a colored background.

This function accepts two color formats:

  • A hexcode, like "#abcdef", capitalization is ignored;
  • Three hsl values, like "hsl {hue} {sat} {lit}", where {hue}, {sat} and {lit} can either be a number from 0..255, or a percentage, followed by '%', e.g. "hsl 234 50% 42".

If this Form was created via Form::mimic, then the other attributes will change as the mimicked color does, but the background won’t.

Source

pub fn underline(self, color: &str) -> Form

New Form with a colored underline..

Note that this doesn’t actually make the underline show up, it merely colors one that is set via a command like Form::underlined.

This function accepts two color formats:

  • A hexcode, like "#abcdef", capitalization is ignored;
  • Three hsl values, like "hsl {hue} {sat} {lit}", where {hue}, {sat} and {lit} can either be a number from 0..255, or a percentage, followed by '%', e.g. "hsl 234 50% 42".

If this Form was created via Form::mimic, then the other attributes will change as the mimicked color does, but the underline color won’t.

Trait Implementations§

Source§

impl Clone for Form

Source§

fn clone(&self) -> Form

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 Form

Source§

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

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

impl Default for Form

Source§

fn default() -> Form

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

impl PartialEq for Form

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Form

Source§

impl Eq for Form

Auto Trait Implementations§

§

impl Freeze for Form

§

impl RefUnwindSafe for Form

§

impl Send for Form

§

impl Sync for Form

§

impl Unpin for Form

§

impl UnsafeUnpin for Form

§

impl UnwindSafe for Form

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.