mirror of https://github.com/helix-editor/helix
feat: Default theme palette using 16 terminal colors
parent
95cd2c645b
commit
e40e6db227
|
@ -123,3 +123,24 @@ black = "#000000"
|
||||||
|
|
||||||
Remember that the `[palette]` table includes all keys after its header,
|
Remember that the `[palette]` table includes all keys after its header,
|
||||||
so you should define the palette after normal theme options.
|
so you should define the palette after normal theme options.
|
||||||
|
|
||||||
|
If there is no `[palette]` section, a default palette which uses the terminal's default 16 colors are used:
|
||||||
|
|
||||||
|
| Color Name |
|
||||||
|
| --- |
|
||||||
|
| `black` |
|
||||||
|
| `red` |
|
||||||
|
| `green` |
|
||||||
|
| `yellow` |
|
||||||
|
| `blue` |
|
||||||
|
| `magenta` |
|
||||||
|
| `cyan` |
|
||||||
|
| `gray` |
|
||||||
|
| `light-red` |
|
||||||
|
| `light-green` |
|
||||||
|
| `light-yellow` |
|
||||||
|
| `light-blue` |
|
||||||
|
| `light-magenta` |
|
||||||
|
| `light-cyan` |
|
||||||
|
| `light-gray` |
|
||||||
|
| `white` |
|
||||||
|
|
|
@ -224,13 +224,13 @@ pub enum Color {
|
||||||
Magenta,
|
Magenta,
|
||||||
Cyan,
|
Cyan,
|
||||||
Gray,
|
Gray,
|
||||||
DarkGray,
|
|
||||||
LightRed,
|
LightRed,
|
||||||
LightGreen,
|
LightGreen,
|
||||||
LightYellow,
|
LightYellow,
|
||||||
LightBlue,
|
LightBlue,
|
||||||
LightMagenta,
|
LightMagenta,
|
||||||
LightCyan,
|
LightCyan,
|
||||||
|
LightGray,
|
||||||
White,
|
White,
|
||||||
Rgb(u8, u8, u8),
|
Rgb(u8, u8, u8),
|
||||||
Indexed(u8),
|
Indexed(u8),
|
||||||
|
@ -250,14 +250,14 @@ impl From<Color> for crossterm::style::Color {
|
||||||
Color::Blue => CColor::DarkBlue,
|
Color::Blue => CColor::DarkBlue,
|
||||||
Color::Magenta => CColor::DarkMagenta,
|
Color::Magenta => CColor::DarkMagenta,
|
||||||
Color::Cyan => CColor::DarkCyan,
|
Color::Cyan => CColor::DarkCyan,
|
||||||
Color::Gray => CColor::Grey,
|
Color::Gray => CColor::DarkGrey,
|
||||||
Color::DarkGray => CColor::DarkGrey,
|
|
||||||
Color::LightRed => CColor::Red,
|
Color::LightRed => CColor::Red,
|
||||||
Color::LightGreen => CColor::Green,
|
Color::LightGreen => CColor::Green,
|
||||||
Color::LightBlue => CColor::Blue,
|
Color::LightBlue => CColor::Blue,
|
||||||
Color::LightYellow => CColor::Yellow,
|
Color::LightYellow => CColor::Yellow,
|
||||||
Color::LightMagenta => CColor::Magenta,
|
Color::LightMagenta => CColor::Magenta,
|
||||||
Color::LightCyan => CColor::Cyan,
|
Color::LightCyan => CColor::Cyan,
|
||||||
|
Color::LightGray => CColor::Grey,
|
||||||
Color::White => CColor::White,
|
Color::White => CColor::White,
|
||||||
Color::Indexed(i) => CColor::AnsiValue(i),
|
Color::Indexed(i) => CColor::AnsiValue(i),
|
||||||
Color::Rgb(r, g, b) => CColor::Rgb { r, g, b },
|
Color::Rgb(r, g, b) => CColor::Rgb { r, g, b },
|
||||||
|
|
|
@ -5,6 +5,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
use helix_core::hashmap;
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use serde::{Deserialize, Deserializer};
|
use serde::{Deserialize, Deserializer};
|
||||||
|
@ -142,7 +143,24 @@ struct ThemePalette {
|
||||||
|
|
||||||
impl Default for ThemePalette {
|
impl Default for ThemePalette {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new(HashMap::new())
|
Self::new(hashmap! {
|
||||||
|
"black".to_string() => Color::Black,
|
||||||
|
"red".to_string() => Color::Red,
|
||||||
|
"green".to_string() => Color::Green,
|
||||||
|
"yellow".to_string() => Color::Yellow,
|
||||||
|
"blue".to_string() => Color::Blue,
|
||||||
|
"magenta".to_string() => Color::Magenta,
|
||||||
|
"cyan".to_string() => Color::Cyan,
|
||||||
|
"gray".to_string() => Color::Gray,
|
||||||
|
"light-red".to_string() => Color::LightRed,
|
||||||
|
"light-green".to_string() => Color::LightGreen,
|
||||||
|
"light-yellow".to_string() => Color::LightYellow,
|
||||||
|
"light-blue".to_string() => Color::LightBlue,
|
||||||
|
"light-magenta".to_string() => Color::LightMagenta,
|
||||||
|
"light-cyan".to_string() => Color::LightCyan,
|
||||||
|
"light-gray".to_string() => Color::LightGray,
|
||||||
|
"white".to_string() => Color::White,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue