Skip to content

Commit 2e59ca9

Browse files
committed
Choose more contrast colors both for dark and light themes
1 parent dcb9610 commit 2e59ca9

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

src/app.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use eframe::egui::{
2-
Align, Button, CentralPanel, Color32, ComboBox, Context, FontId, Grid, Image, Layout, Rect, Spinner, TextStyle,
2+
Align, Button, CentralPanel, ComboBox, Context, FontId, Grid, Image, Layout, Rect, Spinner, TextStyle,
33
TopBottomPanel,
44
};
55
use std::path::PathBuf;
@@ -214,13 +214,13 @@ impl eframe::App for App {
214214
self.hook_metadata.manifest.checksum == 0,
215215
self.hook_metadata.vec_manifests.len() == 0,
216216
) {
217-
(_, _, true, true) => (format!("✖ {}", t!("hook data was not loaded")), Color32::LIGHT_RED),
217+
(_, _, true, true) => (format!("✖ {}", t!("hook data was not loaded")), COLOR_ERROR),
218218
(false, _, _, _) => (
219219
format!("✖ {}", t!("this DF version is not supported")),
220-
Color32::LIGHT_RED,
220+
COLOR_ERROR,
221221
),
222-
(true, true, _, _) => (format!("✅ {}", t!("up-to-date")), Color32::LIGHT_GREEN),
223-
(true, false, _, _) => (format!("⚠ {}", t!("update available")), Color32::from_rgb(255, 255, 90)),
222+
(true, true, _, _) => (format!("✅ {}", t!("up-to-date")), COLOR_UP_TO_DATE),
223+
(true, false, _, _) => (format!("⚠ {}", t!("update available")), COLOR_UPDATE_AVAILABLE),
224224
};
225225
ui.colored_label(color, text);
226226

@@ -272,11 +272,11 @@ impl eframe::App for App {
272272
) {
273273
(_, _, true) => (
274274
format!("✖ {}", t!("dictionary data was not loaded")),
275-
Color32::LIGHT_RED,
275+
COLOR_ERROR,
276276
),
277-
(true, false, false) => (format!("✅ {}", t!("up-to-date")), Color32::LIGHT_GREEN),
278-
(false, false, false) => (format!("⚠ {}", t!("update available")), Color32::from_rgb(255, 255, 90)),
279-
(_, true, false) => (format!("⚠ {}", t!("choose language")), Color32::from_rgb(255, 255, 90)),
277+
(true, false, false) => (format!("✅ {}", t!("up-to-date")), COLOR_UP_TO_DATE),
278+
(false, false, false) => (format!("⚠ {}", t!("update available")), COLOR_UPDATE_AVAILABLE),
279+
(_, true, false) => (format!("⚠ {}", t!("choose language")), COLOR_CHOOSE_LANGUAGE),
280280
};
281281
ui.colored_label(color, text);
282282
ui.end_row();

src/constants.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use eframe::egui::Color32;
2+
13
pub const VERSION: &'static str = env!("CARGO_PKG_VERSION");
24

35
pub const GITHUB_ICON: eframe::egui::widgets::ImageSource<'static> =
@@ -22,3 +24,8 @@ pub const PATH_OFFSETS: &'static str = "dfint-data/offsets.toml";
2224
pub const PATH_DICT: &'static str = "dfint-data/dictionary.csv";
2325
pub const PATH_FONT: &'static str = "data/art/curses_640x300.png";
2426
pub const PATH_ENCODING: &'static str = "dfint-data/encoding.toml";
27+
28+
pub const COLOR_UP_TO_DATE: Color32 = Color32::from_rgb(67, 160, 71);
29+
pub const COLOR_UPDATE_AVAILABLE: Color32 = Color32::from_rgb(230, 184, 0);
30+
pub const COLOR_CHOOSE_LANGUAGE: Color32 = Color32::from_rgb(230, 184, 0);
31+
pub const COLOR_ERROR: Color32 = Color32::from_rgb(211, 47, 47);

src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ extern crate serde_derive;
66
use anyhow::Result;
77
use constants::APP_ICON;
88
use eframe::egui;
9+
// use eframe::egui::{Style, Visuals};
910

1011
mod app;
1112
mod constants;
@@ -31,6 +32,11 @@ fn main() -> Result<(), eframe::Error> {
3132
"DF localization installer",
3233
options,
3334
Box::new(|cc| {
35+
// let style = Style {
36+
// visuals: Visuals::light(),
37+
// ..Style::default()
38+
// };
39+
// cc.egui_ctx.set_style(style);
3440
egui_extras::install_image_loaders(&cc.egui_ctx);
3541
Box::<app::App>::default()
3642
}),

0 commit comments

Comments
 (0)