From 9db2eb91ad8139daa326496813199c56ae869415 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Sun, 19 Jan 2025 17:57:51 -0500 Subject: [PATCH] wip: color mapping from style color names --- Cargo.lock | 7 ++++++ Cargo.toml | 1 + src/book/mod.rs | 13 +++++++++- src/ui/render/test.rs | 28 +++++++++++++++++++++ src/ui/render/viewport.rs | 52 +++++++++++++++++++++++++++++++++++---- 5 files changed, 95 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e096f7e..f7d3e8f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -369,6 +369,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +[[package]] +name = "colorsys" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54261aba646433cb567ec89844be4c4825ca92a4f8afba52fc4dd88436e31bbd" + [[package]] name = "compact_str" version = "0.8.0" @@ -1483,6 +1489,7 @@ version = "0.1.0" dependencies = [ "anyhow", "clap", + "colorsys", "crossterm", "csvx", "futures", diff --git a/Cargo.toml b/Cargo.toml index d337a2a..5da5cb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,3 +19,4 @@ tui-prompts = "0.5.0" slice-utils = { git = "https://dev.zaphar.net/zaphar/slice-cursor-rs.git", ref = "main" } tui-popup = "0.6.0" serde_json = "1.0.133" +colorsys = "0.6.7" diff --git a/src/book/mod.rs b/src/book/mod.rs index 91c11b9..e2c2103 100644 --- a/src/book/mod.rs +++ b/src/book/mod.rs @@ -3,7 +3,7 @@ use std::cmp::max; use anyhow::{anyhow, Result}; use ironcalc::{ base::{ - types::{SheetData, Worksheet}, + types::{CellStyleXfs, CellStyles, SheetData, Style, Worksheet}, worksheet::WorksheetDimension, Model, }, @@ -240,6 +240,17 @@ impl Book { Ok(self.get_cell_addr_rendered(&self.location)?) } + pub fn get_cell_style(&self, sheet: u32, cell: &Address) -> Option