Split dark and light color schemes

This commit is contained in:
Jeremy Soller 2024-02-22 11:18:13 -07:00
parent f5ac834b11
commit 235ebd6180
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
5 changed files with 333 additions and 154 deletions

View file

@ -6,7 +6,7 @@ use hex_color::HexColor;
use palette::{encoding::Srgb, rgb::Rgb as PRgb, FromColor, Okhsl};
use std::{collections::HashMap, fs};
use crate::config::{ColorScheme, ColorSchemeAnsi};
use crate::config::{ColorScheme, ColorSchemeAnsi, ColorSchemeKind};
// Fill missing dim/bright colors with derived values from normal ones.
#[allow(dead_code)]
@ -335,17 +335,23 @@ fn cosmic_light() -> Colors {
}
// Get builtin themes
pub fn terminal_themes() -> HashMap<String, Colors> {
pub fn terminal_themes() -> HashMap<(String, ColorSchemeKind), Colors> {
let mut themes = HashMap::new();
themes.insert("COSMIC Dark".to_string(), cosmic_dark());
themes.insert("COSMIC Light".to_string(), cosmic_light());
themes.insert(
("COSMIC Dark".to_string(), ColorSchemeKind::Dark),
cosmic_dark(),
);
themes.insert(
("COSMIC Light".to_string(), ColorSchemeKind::Light),
cosmic_light(),
);
themes
}
// Helper function to export builtin themes to theme files
#[allow(dead_code)]
pub fn export() {
for (name, theme) in terminal_themes() {
for ((name, _color_scheme_kind), theme) in terminal_themes() {
let color_scheme = ColorScheme::from((name.as_str(), &theme));
// Ensure conversion to and from ColorScheme matches original theme