Extend UserSyntax to allow font_style and font_weight to be specified
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
This commit is contained in:
co-authored by
Marshall Bowers
parent
978cff8095
commit
ff053890cf
@@ -1,4 +1,4 @@
|
||||
use gpui::Hsla;
|
||||
use gpui::{FontWeight, Hsla};
|
||||
use refineable::Refineable;
|
||||
use serde::Deserialize;
|
||||
|
||||
@@ -36,6 +36,39 @@ pub struct UserSyntaxTheme {
|
||||
#[derive(Clone, Default, Deserialize)]
|
||||
pub struct UserHighlightStyle {
|
||||
pub color: Option<Hsla>,
|
||||
pub font_style: Option<UserFontStyle>,
|
||||
pub font_weight: Option<UserFontWeight>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Deserialize)]
|
||||
pub struct UserFontWeight(pub f32);
|
||||
|
||||
impl UserFontWeight {
|
||||
/// Thin weight (100), the thinnest value.
|
||||
pub const THIN: Self = Self(FontWeight::THIN.0);
|
||||
/// Extra light weight (200).
|
||||
pub const EXTRA_LIGHT: Self = Self(FontWeight::EXTRA_LIGHT.0);
|
||||
/// Light weight (300).
|
||||
pub const LIGHT: Self = Self(FontWeight::LIGHT.0);
|
||||
/// Normal (400).
|
||||
pub const NORMAL: Self = Self(FontWeight::NORMAL.0);
|
||||
/// Medium weight (500, higher than normal).
|
||||
pub const MEDIUM: Self = Self(FontWeight::MEDIUM.0);
|
||||
/// Semibold weight (600).
|
||||
pub const SEMIBOLD: Self = Self(FontWeight::SEMIBOLD.0);
|
||||
/// Bold weight (700).
|
||||
pub const BOLD: Self = Self(FontWeight::BOLD.0);
|
||||
/// Extra-bold weight (800).
|
||||
pub const EXTRA_BOLD: Self = Self(FontWeight::EXTRA_BOLD.0);
|
||||
/// Black weight (900), the thickest value.
|
||||
pub const BLACK: Self = Self(FontWeight::BLACK.0);
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Deserialize)]
|
||||
pub enum UserFontStyle {
|
||||
Normal,
|
||||
Italic,
|
||||
Oblique,
|
||||
}
|
||||
|
||||
impl UserHighlightStyle {
|
||||
|
||||
Reference in New Issue
Block a user