chromakitx 1.0.2

A comprehensive color manipulation library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// SPDX-FileCopyrightText: 2023 CELESTIFYX Team
// SPDX-License-Identifier: GPL-3.0-or-later

use regex::Regex;
use std::sync::LazyLock;

pub const MIN_HSL_VALUE: f32 = 0.0;
pub const MAX_HSL_VALUE: f32 = 1.0;
pub const MIN_HSV_VALUE: f32 = 0.0;
pub const MAX_HSV_VALUE: f32 = 100.0;
pub const VALID_HEX_LENGTHS: [usize; 2] = [3, 6];
pub const VALID_HEX_CHARS: &str = "0123456789ABCDEF";

pub static HEX_PATTERN: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"^[0-9A-F]{6}$").unwrap());
pub static ANSI_PATTERN: LazyLock<Regex> = LazyLock::new(|| Regex::new(r"\x1B(?:\[[0-9;?]*[A-Za-z]|][^\x07]*\x07|[PX^_].*?\x1b\\)").unwrap());