Skip to content

Commit

Permalink
Using catppuccin for colors in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethlove committed Aug 15, 2024
1 parent 24807e8 commit 3391ad2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/cli/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,18 @@ pub fn get_database_url() -> String {
let path = Path::new(&dirs::data_local_dir().unwrap()).join(cli.database_url);
path.to_string_lossy().to_string()
}
use catppuccin::PALETTE;

const fn ansi(color: &catppuccin::Color) -> ansi_term::Colour {
ansi_term::Colour::RGB(color.rgb.r, color.rgb.g, color.rgb.b)
}

/// Parses command line options
pub fn parse() {
let cli = Cli::parse();
let db_url = get_database_url();
let mut db = Database::new(&db_url).expect("Could not load database");
let response_style = Style::new().bold().fg(Color::Green);
let response_style = Style::new().bold().fg(ansi(&PALETTE.mocha.colors.mauve));
match &cli.command {
Commands::Add { task, frequency } => match frequency {
Frequency::Daily => {
Expand Down Expand Up @@ -238,8 +243,6 @@ pub fn parse() {

#[cfg(test)]
mod tests {
use super::get_sort_order;
use crate::sorting::{SortByDirection, SortByField};
use assert_cmd::Command;
use assert_fs::TempDir;
use rstest::*;
Expand Down

0 comments on commit 3391ad2

Please sign in to comment.