Skip to content

Commit

Permalink
Choose more contrast colors both for dark and light themes
Browse files Browse the repository at this point in the history
  • Loading branch information
insolor committed Dec 10, 2024
1 parent dcb9610 commit 2e59ca9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/app.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use eframe::egui::{
Align, Button, CentralPanel, Color32, ComboBox, Context, FontId, Grid, Image, Layout, Rect, Spinner, TextStyle,
Align, Button, CentralPanel, ComboBox, Context, FontId, Grid, Image, Layout, Rect, Spinner, TextStyle,
TopBottomPanel,
};
use std::path::PathBuf;
Expand Down Expand Up @@ -214,13 +214,13 @@ impl eframe::App for App {
self.hook_metadata.manifest.checksum == 0,
self.hook_metadata.vec_manifests.len() == 0,
) {
(_, _, true, true) => (format!("✖ {}", t!("hook data was not loaded")), Color32::LIGHT_RED),
(_, _, true, true) => (format!("✖ {}", t!("hook data was not loaded")), COLOR_ERROR),
(false, _, _, _) => (
format!("✖ {}", t!("this DF version is not supported")),
Color32::LIGHT_RED,
COLOR_ERROR,
),
(true, true, _, _) => (format!("✅ {}", t!("up-to-date")), Color32::LIGHT_GREEN),
(true, false, _, _) => (format!("⚠ {}", t!("update available")), Color32::from_rgb(255, 255, 90)),
(true, true, _, _) => (format!("✅ {}", t!("up-to-date")), COLOR_UP_TO_DATE),
(true, false, _, _) => (format!("⚠ {}", t!("update available")), COLOR_UPDATE_AVAILABLE),
};
ui.colored_label(color, text);

Expand Down Expand Up @@ -272,11 +272,11 @@ impl eframe::App for App {
) {
(_, _, true) => (
format!("✖ {}", t!("dictionary data was not loaded")),
Color32::LIGHT_RED,
COLOR_ERROR,
),
(true, false, false) => (format!("✅ {}", t!("up-to-date")), Color32::LIGHT_GREEN),
(false, false, false) => (format!("⚠ {}", t!("update available")), Color32::from_rgb(255, 255, 90)),
(_, true, false) => (format!("⚠ {}", t!("choose language")), Color32::from_rgb(255, 255, 90)),
(true, false, false) => (format!("✅ {}", t!("up-to-date")), COLOR_UP_TO_DATE),
(false, false, false) => (format!("⚠ {}", t!("update available")), COLOR_UPDATE_AVAILABLE),
(_, true, false) => (format!("⚠ {}", t!("choose language")), COLOR_CHOOSE_LANGUAGE),
};
ui.colored_label(color, text);
ui.end_row();
Expand Down
7 changes: 7 additions & 0 deletions src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use eframe::egui::Color32;

pub const VERSION: &'static str = env!("CARGO_PKG_VERSION");

pub const GITHUB_ICON: eframe::egui::widgets::ImageSource<'static> =
Expand All @@ -22,3 +24,8 @@ pub const PATH_OFFSETS: &'static str = "dfint-data/offsets.toml";
pub const PATH_DICT: &'static str = "dfint-data/dictionary.csv";
pub const PATH_FONT: &'static str = "data/art/curses_640x300.png";
pub const PATH_ENCODING: &'static str = "dfint-data/encoding.toml";

pub const COLOR_UP_TO_DATE: Color32 = Color32::from_rgb(67, 160, 71);
pub const COLOR_UPDATE_AVAILABLE: Color32 = Color32::from_rgb(230, 184, 0);
pub const COLOR_CHOOSE_LANGUAGE: Color32 = Color32::from_rgb(230, 184, 0);
pub const COLOR_ERROR: Color32 = Color32::from_rgb(211, 47, 47);
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern crate serde_derive;
use anyhow::Result;
use constants::APP_ICON;
use eframe::egui;
// use eframe::egui::{Style, Visuals};

mod app;
mod constants;
Expand All @@ -31,6 +32,11 @@ fn main() -> Result<(), eframe::Error> {
"DF localization installer",
options,
Box::new(|cc| {
// let style = Style {
// visuals: Visuals::light(),
// ..Style::default()
// };
// cc.egui_ctx.set_style(style);
egui_extras::install_image_loaders(&cc.egui_ctx);
Box::<app::App>::default()
}),
Expand Down

0 comments on commit 2e59ca9

Please sign in to comment.