From d4c1d51e36626b1682b96e746bb32632dadcac2c Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Sat, 15 Oct 2016 15:56:27 -0700 Subject: Make colors configurable from file Added solarized dark color scheme for testing purposes. Resolves #1. --- src/renderer/mod.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/renderer') diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 23157456..7ddf1d01 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -610,11 +610,13 @@ impl<'a> RenderApi<'a> { } /// Render a string in a predefined location. Used for printing render time for profiling and /// optimization. - pub fn render_string(&mut self, - s: &str, - glyph_cache: &mut GlyphCache, - color: &Rgb) - { + pub fn render_string( + &mut self, + bg: &Rgb, + s: &str, + glyph_cache: &mut GlyphCache, + color: &Rgb, + ) { let row = 40.0; let mut col = 100.0; @@ -629,7 +631,7 @@ impl<'a> RenderApi<'a> { let cell = Cell { c: c, fg: *color, - bg: term::DEFAULT_BG, + bg: *bg, flags: cell::INVERSE, }; self.add_render_item(row, col, &cell, glyph); @@ -656,12 +658,12 @@ impl<'a> RenderApi<'a> { } } - pub fn render_grid(&mut self, grid: &Grid, glyph_cache: &mut GlyphCache) { + pub fn render_grid(&mut self, bg: &Rgb, grid: &Grid, glyph_cache: &mut GlyphCache) { for (i, line) in grid.lines().enumerate() { for (j, cell) in line.cells().enumerate() { // Skip empty cells if cell.c == ' ' && - cell.bg == term::DEFAULT_BG && + cell.bg == *bg && !cell.flags.contains(cell::INVERSE) { continue; -- cgit