feat: basic vscode theme export support

This commit is contained in:
Ashley Wulber 2024-05-12 22:16:53 -04:00 committed by Ashley Wulber
parent 05a9e7639f
commit c1cfa024d6
6 changed files with 378 additions and 23 deletions

View file

@ -5,15 +5,8 @@ use std::{
io::Write,
num::NonZeroUsize,
};
use thiserror::Error;
#[derive(Error, Debug)]
pub enum OutputError {
#[error("IO Error: {0}")]
Io(std::io::Error),
#[error("Missing config directory")]
MissingConfigDir,
}
use super::{to_hex, OutputError};
impl Theme {
#[must_use]
@ -249,11 +242,6 @@ fn component_gtk4_css(prefix: &str, c: &Component) -> String {
)
}
fn to_hex(c: Srgba) -> String {
let c_u8: Rgba<palette::encoding::Srgb, u8> = c.into_format();
format!("{:02x}{:02x}{:02x}", c_u8.red, c_u8.green, c_u8.blue)
}
fn color_css(prefix: &str, c_3: Srgba) -> String {
let oklch: palette::Oklch = c_3.into_color();
let c_2: Srgba = oklch.lighten(0.1).into_color();