Parse hex colors to tui::style::Color

Overview

Color -> Tui

build build

Parse hex colors to tui rgb colors

#c3f111 -> Color::Rgb(195,241,17)

Note that the indexed colors are NOT HEX
#142 -> Color::Indexed(142)

Example

#[derive(Serialize, Deserialize, PartialEq)]
sruct ColorStruct {
    #[serde(with = "color-parser-tui"]
    color: tui::style::Color,
    #[serde(with = "color-parser-tui::optional"]
    optional_color: Option<tui::style::Color>,
}

let color_text =  r###"{ "color" : "#12FC1C", "optional_color" : "#123" }"###
let t: ColorStruct = serde_json::from_str::<ColorStruct>(color_text).unwrap();

let c = ColorStruct {
    color: Color::Rgb(18, 252, 28),
    optional_color: Option<Color::Indexed(123)>,
};

assert_eq!(t, c);
You might also like...
Not the fastest terminal colors library. Don't even ask about size.
Not the fastest terminal colors library. Don't even ask about size.

TROLOLORS Not the fastest terminal colors library. Don't even ask about size. Why? Don't even try to use it. But maybe you need to say to your boss th

Vari (Väri) is a Rust library for formatting strings with colors and cosmetic stuff to the terminal.
Vari (Väri) is a Rust library for formatting strings with colors and cosmetic stuff to the terminal.

Vari Vari (Väri) is a Rust library for formatting strings with colors and cosmetic stuff to the terminal. Like Rich library for Python. Väri means "co

Customize window border colors :3
Customize window border colors :3

cute-borders Makes focused and unfocused window borders have a different border color, configurable per program. Windows 11 only. Preview Installing D

Parse command line arguments by defining a struct.

StructOpt Parse command line arguments by defining a struct. It combines clap with custom derive. Documentation Find it on Docs.rs. You can also check

parse command-line arguments into a hashmap and vec of positional args

parse command-line arguments into a hashmap and vec of positional args This library doesn't populate custom structs, format help messages, or convert types.

A CLI command to parse kustomize build result and notify it to GitLab

ksnotify A CLI command to parse kustomize build result and notify it to GitLab Caution This repository is under development status. What ksnotify does

Vim plugin to quickly parse strings into arrays.

butcher Vim plugin to quickly parse strings into arrays. It is painful to write arrays in any programming language, so butcher makes it easy for you.

Irx-config - The library provides convenient way to represent/parse configuration from different sources

The irx-config library provides convenient way to represent/parse configuration from different sources. The main goals is to be very easy to use and t

Anglosaxon is a command line tool to parse XML files using SAX
Anglosaxon is a command line tool to parse XML files using SAX

anglosaxon - Convert large XML files to other formats anglosaxon is a command line tool to parse XML files using SAX. You can do simple transformation

Comments
  • Slight changes to README's formatting

    Slight changes to README's formatting

    Check me out.

    • I linked to tui-rs and the Rgb enum in case someone wandering the interwebs has no idea what TUI or RGB means.
    • I also added a shorthand hex color example.

    Note: the span has no effect on the formatting.

    opened by grtcdr 10
  • Bump `tui` dependency to v0.18.0

    Bump `tui` dependency to v0.18.0

    Hey, Uttarayan :)

    I recently tried to bump all of macchina's dependencies and wasn't able to do so because this crate has an older version. This PR, like the title suggests, bumps tui to its latest version.

    opened by grtcdr 3
Owner
Uttarayan Mondal
I write suff
Uttarayan Mondal
A rust crate for working with colors and color spaces.

Color Art A rust crate for working with colors and color spaces. Documentation See Color Art. Usage Add Dependency [dependencies] color-art = "0.2" Co

cx33 5 Dec 30, 2022
Tiny color conversion library for TUI application builders

Definition of ANSI, RGB and HSL color types and all the conversions between them. There are many other color conversion crates. This one may be useful

Canop 8 Dec 15, 2022
A user-friendly TUI for secure file transfers, with arrow-key and VIM-style navigation

gsftp SFTP with an interactive text-based user interface (TUI). Transfer files through an encrypted connection with a visual interface, so you can see

Ben Jiron 3 Jul 7, 2022
A template for bootstrapping a Rust TUI application with tui-rs & crossterm

rust-tui-template A template for bootstrapping a Rust TUI application with tui-rs & crossterm. tui-rs The library is based on the principle of immedia

Orhun Parmaksız 72 Dec 31, 2022
Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers

Cork is a simple command-line calculator, mainly targeted towards people who deal with hex numbers. It deals only with integer arithmetic. Expressions may involve mixed bases (limited to decimal, hexadecimal, octal and binary numbers). The global output format may be set to a particular radix - by default it is hex.

Deep Majumder 50 Dec 22, 2022
hexyl is a simple hex viewer for the terminal. It uses a colored output to distinguish different categories of bytes

hexyl is a simple hex viewer for the terminal. It uses a colored output to distinguish different categories of bytes (NULL bytes, printable ASCII characters, ASCII whitespace characters, other ASCII characters and non-ASCII).

David Peter 7.3k Dec 29, 2022
A user-friendly re-implementation of existing hex tools in Rust

Hex A project to create alternate (and more user friendly) versions of existing hex tools. The project can be installed as a extension to the github-c

Sohom Datta 6 Sep 27, 2022
convert nostr keys and note-ids between hex and bech32

Key-Convertr People are copy-pasting nostr private keys into webpages to convert between the original hex-encoding and bech32-encoding (specified in N

Rijndael 14 Jan 9, 2023
Command-Line program that takes images and produces the copy of the image with a thin frame and palette made of the 10 most frequent colors.

paleatra v.0.0.1 Command-Line program that takes an image and produces the copy of the image with a thin frame and palette made of the 10 most frequen

Beka Modebadze 24 Dec 29, 2022
A CLI utility installed as "ansi" to quickly get ANSI escape sequences. Supports the most basic ones, like colors and styles as bold or italic.

'ansi' - a CLI utility to quickly get ANSI escape codes This Rust project called ansi-escape-sequences-cli provides an executable called ansi which ca

Philipp Schuster 5 Jul 28, 2022