aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2016-10-15 15:56:27 -0700
committerJoe Wilm <joe@jwilm.com>2016-10-15 15:56:27 -0700
commitd4c1d51e36626b1682b96e746bb32632dadcac2c (patch)
tree83d1f06ee6019ac5488c3559dbe8c248db1a44f8 /src/main.rs
parent71de5501c450eeaa363aa5403a5258d231d64935 (diff)
downloadr-alacritty-d4c1d51e36626b1682b96e746bb32632dadcac2c.tar.gz
r-alacritty-d4c1d51e36626b1682b96e746bb32632dadcac2c.tar.bz2
r-alacritty-d4c1d51e36626b1682b96e746bb32632dadcac2c.zip
Make colors configurable from file
Added solarized dark color scheme for testing purposes. Resolves #1.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/main.rs b/src/main.rs
index afc60a66..9639fd29 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -179,7 +179,13 @@ fn main() {
println!("Cell Size: ({} x {})", cell_width, cell_height);
- let terminal = Term::new(width as f32, height as f32, cell_width as f32, cell_height as f32);
+ let terminal = Term::new(
+ &config,
+ width as f32,
+ height as f32,
+ cell_width as f32,
+ cell_height as f32
+ );
let pty_io = terminal.tty().reader();
let (tx, rx) = mpsc::channel();
@@ -208,6 +214,7 @@ fn main() {
window.clone(),
renderer,
glyph_cache,
+ config.bg_color(),
render_timer,
rx
);
@@ -241,13 +248,14 @@ fn main() {
println!("Goodbye");
}
-
-
struct Display {
window: Arc<glutin::Window>,
renderer: QuadRenderer,
glyph_cache: GlyphCache,
render_timer: bool,
+ clear_red: f32,
+ clear_blue: f32,
+ clear_green: f32,
rx: mpsc::Receiver<(u32, u32)>,
meter: Meter,
}
@@ -256,6 +264,7 @@ impl Display {
pub fn new(window: Arc<glutin::Window>,
renderer: QuadRenderer,
glyph_cache: GlyphCache,
+ clear_color: Rgb,
render_timer: bool,
rx: mpsc::Receiver<(u32, u32)>)
-> Display
@@ -265,6 +274,9 @@ impl Display {
renderer: renderer,
glyph_cache: glyph_cache,
render_timer: render_timer,
+ clear_red: clear_color.r as f32 / 255.0,
+ clear_blue: clear_color.g as f32 / 255.0,
+ clear_green: clear_color.b as f32 / 255.0,
rx: rx,
meter: Meter::new(),
}
@@ -285,7 +297,7 @@ impl Display {
// TODO should be built into renderer
unsafe {
- gl::ClearColor(0.0, 0.0, 0.00, 1.0);
+ gl::ClearColor(self.clear_red, self.clear_blue, self.clear_green, 1.0);
gl::Clear(gl::COLOR_BUFFER_BIT);
}
@@ -310,7 +322,8 @@ impl Display {
let size_info = terminal.size_info().clone();
self.renderer.with_api(&size_info, |mut api| {
// Draw the grid
- api.render_grid(&terminal.render_grid(), glyph_cache);
+ let bg = terminal.bg;
+ api.render_grid(&bg, &terminal.render_grid(), glyph_cache);
});
}
@@ -319,7 +332,8 @@ impl Display {
let timing = format!("{:.3} usec", self.meter.average());
let color = Rgb { r: 0xd5, g: 0x4e, b: 0x53 };
self.renderer.with_api(terminal.size_info(), |mut api| {
- api.render_string(&timing[..], glyph_cache, &color);
+ let bg = terminal.bg;
+ api.render_string(&bg, &timing[..], glyph_cache, &color);
});
}
}