Custom Colors (#70)

* First implementation of custom colors

* Remove use-statement

Co-authored-by: June <61218022+itsjunetime@users.noreply.github.com>

* Cleaned up help-text

Co-authored-by: June <61218022+itsjunetime@users.noreply.github.com>

* Removed superfluous features from csscolorparser

* Fix for clippy

* Clarify how to pass in custom colors

* Explicitly install clippy and rustfmt in CI

* Better error handling when colors can not be parsed

Co-authored-by: June <61218022+itsjunetime@users.noreply.github.com>

* More elegant type conversion

Co-authored-by: June <61218022+itsjunetime@users.noreply.github.com>

* Made clippy happy

---------

Co-authored-by: June <61218022+itsjunetime@users.noreply.github.com>
Co-authored-by: itsjunetime <junewelker@gmail.com>
This commit is contained in:
JanNeuendorf
2025-05-28 19:16:07 +02:00
committed by GitHub
parent 2f4e2a54bc
commit e16163efb8
8 changed files with 76 additions and 20 deletions
+10 -6
View File
@@ -57,7 +57,9 @@ pub struct RenderState {
const FONT_SIZE: (u16, u16) = (8, 14);
pub fn start_rendering_loop(
path: impl AsRef<Path>
path: impl AsRef<Path>,
black: i32,
white: i32
) -> (
RecvStream<'static, Result<RenderInfo, RenderError>>,
Sender<RenderNotif>
@@ -91,7 +93,9 @@ pub fn start_rendering_loop(
to_main_tx,
from_main_rx,
size,
tdf::PrerenderLimit::All
tdf::PrerenderLimit::All,
black,
white
)
});
@@ -122,8 +126,8 @@ pub fn start_converting_loop(
(from_converter_rx, to_converter_tx)
}
pub fn start_all_rendering(path: impl AsRef<Path>) -> RenderState {
let (from_render_rx, to_render_tx) = start_rendering_loop(path);
pub fn start_all_rendering(path: impl AsRef<Path>, black: i32, white: i32) -> RenderState {
let (from_render_rx, to_render_tx) = start_rendering_loop(path, black, white);
let (from_converter_rx, to_converter_tx) = start_converting_loop(20);
let pages: Vec<Option<ConvertedPage>> = Vec::new();
@@ -137,14 +141,14 @@ pub fn start_all_rendering(path: impl AsRef<Path>) -> RenderState {
}
}
pub async fn render_doc(path: impl AsRef<Path>, search_term: Option<&str>) {
pub async fn render_doc(path: impl AsRef<Path>, search_term: Option<&str>, black: i32, white: i32) {
let RenderState {
mut from_render_rx,
mut from_converter_rx,
mut pages,
mut to_converter_tx,
to_render_tx
} = start_all_rendering(path);
} = start_all_rendering(path, black, white);
if let Some(term) = search_term {
to_render_tx