106 lines
2.4 KiB
Rust
106 lines
2.4 KiB
Rust
// Copyright (c) 2022 Marceline Cramer
|
|
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
use hex_color::HexColor;
|
|
use serde::{Deserialize, Serialize};
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
pub struct CursorConfig {}
|
|
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
pub struct ColorConfig {
|
|
pub background: HexColor,
|
|
pub foreground: HexColor,
|
|
pub black: HexColor,
|
|
pub red: HexColor,
|
|
pub green: HexColor,
|
|
pub yellow: HexColor,
|
|
pub blue: HexColor,
|
|
pub magenta: HexColor,
|
|
pub cyan: HexColor,
|
|
pub white: HexColor,
|
|
pub bright_black: HexColor,
|
|
pub bright_red: HexColor,
|
|
pub bright_green: HexColor,
|
|
pub bright_yellow: HexColor,
|
|
pub bright_blue: HexColor,
|
|
pub bright_magenta: HexColor,
|
|
pub bright_cyan: HexColor,
|
|
pub bright_white: HexColor,
|
|
}
|
|
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
pub struct DrawConfig {
|
|
pub pad_x: u8,
|
|
pub pad_y: u8,
|
|
}
|
|
|
|
impl Default for DrawConfig {
|
|
fn default() -> Self {
|
|
Self { pad_x: 2, pad_y: 2 }
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Default, Deserialize, Serialize)]
|
|
pub struct FontConfig {
|
|
pub normal: PathBuf,
|
|
pub bold: PathBuf,
|
|
}
|
|
|
|
#[derive(Debug, Default, Deserialize, Serialize)]
|
|
pub struct SystemConfig {
|
|
pub shell: String,
|
|
}
|
|
|
|
#[derive(Debug, Default, Deserialize, Serialize)]
|
|
pub struct Config {
|
|
pub cursor: CursorConfig,
|
|
pub colors: ColorConfig,
|
|
pub draw: DrawConfig,
|
|
pub fonts: FontConfig,
|
|
pub system: SystemConfig,
|
|
}
|
|
|
|
impl Default for CursorConfig {
|
|
fn default() -> Self {
|
|
Self {}
|
|
}
|
|
}
|
|
|
|
impl Default for ColorConfig {
|
|
fn default() -> Self {
|
|
let rgb = HexColor::rgb;
|
|
|
|
let black = rgb(96, 96, 96);
|
|
let red = rgb(255, 0, 0);
|
|
let green = rgb(0, 255, 0);
|
|
let yellow = rgb(255, 255, 0);
|
|
let blue = rgb(0, 0, 255);
|
|
let magenta = rgb(255, 0, 255);
|
|
let cyan = rgb(0, 255, 255);
|
|
let white = rgb(224, 224, 224);
|
|
|
|
Self {
|
|
background: rgb(0, 0, 0),
|
|
foreground: rgb(255, 255, 255),
|
|
black,
|
|
red,
|
|
green,
|
|
yellow,
|
|
blue,
|
|
magenta,
|
|
cyan,
|
|
white,
|
|
bright_black: black,
|
|
bright_red: red,
|
|
bright_green: green,
|
|
bright_yellow: yellow,
|
|
bright_blue: blue,
|
|
bright_magenta: magenta,
|
|
bright_cyan: cyan,
|
|
bright_white: white,
|
|
}
|
|
}
|
|
}
|