mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
adress review comments
This commit is contained in:
parent
2f7088c1f3
commit
328c4d002f
@ -16,7 +16,7 @@ ## Creating a theme
|
||||
key = { fg = "#ffffff", bg = "#000000", underline-color = "#ff0000", underline-style = "curl", modifiers = ["bold", "italic"] }
|
||||
```
|
||||
|
||||
where `key` represents what you want to style, `fg` specifies the foreground color, `bg` the background color, `underline_style` the underline style, `underline_color` the underline color (only meaningful if an underline style is enabled), and `modifiers` is a list of style modifiers. `bg`, `underline` and `modifiers` can be omitted to defer to the defaults.
|
||||
where `key` represents what you want to style, `fg` specifies the foreground color, `bg` the background color, `underline-style` the underline style, `underline-color` the underline color (only meaningful if an underline style is enabled), and `modifiers` is a list of style modifiers. `bg`, `underline` and `modifiers` can be omitted to defer to the defaults.
|
||||
|
||||
To specify only the foreground color:
|
||||
|
||||
|
@ -365,16 +365,16 @@ fn from(style: UnderlineStyle) -> Self {
|
||||
///
|
||||
/// let m = Modifier::BOLD | Modifier::ITALIC;
|
||||
/// ```
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize), serde(rename_all = "kebab-case"))]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct Modifier: u16 {
|
||||
const BOLD = 0b0000_0000_0000_0001;
|
||||
const DIM = 0b0000_0000_0000_0010;
|
||||
const ITALIC = 0b0000_0000_0000_0100;
|
||||
const SLOW_BLINK = 0b0000_0000_0001_0000;
|
||||
const RAPID_BLINK = 0b0000_0000_0010_0000;
|
||||
const REVERSED = 0b0000_0000_0100_0000;
|
||||
const HIDDEN = 0b0000_0000_1000_0000;
|
||||
const CROSSED_OUT = 0b0000_0001_0000_0000;
|
||||
const BOLD = 0b0000_0000_0001;
|
||||
const DIM = 0b0000_0000_0010;
|
||||
const ITALIC = 0b0000_0000_0100;
|
||||
const SLOW_BLINK = 0b0000_0001_0000;
|
||||
const RAPID_BLINK = 0b0000_0010_0000;
|
||||
const REVERSED = 0b0000_0100_0000;
|
||||
const HIDDEN = 0b0000_1000_0000;
|
||||
const CROSSED_OUT = 0b0001_0000_0000;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ pub fn parse_underline_style(value: &Value) -> Result<UnderlineStyle, String> {
|
||||
value
|
||||
.as_str()
|
||||
.and_then(|s| s.parse().ok())
|
||||
.ok_or(format!("Theme: invalid underline_style: {}", value))
|
||||
.ok_or(format!("Theme: invalid underline-style: {}", value))
|
||||
}
|
||||
|
||||
pub fn parse_style(&self, style: &mut Style, value: Value) -> Result<(), String> {
|
||||
@ -279,7 +279,6 @@ pub fn parse_style(&self, style: &mut Style, value: Value) -> Result<(), String>
|
||||
"bg" => *style = style.bg(self.parse_color(value)?),
|
||||
"underline-color" => *style = style.underline_color(self.parse_color(value)?),
|
||||
"underline-style" => {
|
||||
warn!("found style");
|
||||
*style = style.underline_style(Self::parse_underline_style(&value)?)
|
||||
}
|
||||
"modifiers" => {
|
||||
|
Loading…
Reference in New Issue
Block a user