Tweak text colors

This commit is contained in:
2025-07-06 19:57:14 +02:00
parent 98a4f50031
commit 6e59cb86dc
4 changed files with 21 additions and 17 deletions

View File

@ -8,8 +8,8 @@ use std::{
use crate::{file_editor::FileEditor, folder::Folder, preferences::Preferences, util::GuiSender}; use crate::{file_editor::FileEditor, folder::Folder, preferences::Preferences, util::GuiSender};
use egui::{ use egui::{
Align, Button, Color32, Context, FontData, FontDefinitions, Image, Key, Modifiers, Align, Button, Context, FontData, FontDefinitions, Image, Key, Modifiers, PointerButton,
PointerButton, RichText, ScrollArea, Stroke, Widget, include_image, RichText, ScrollArea, Widget, include_image,
}; };
#[derive(serde::Deserialize, serde::Serialize)] #[derive(serde::Deserialize, serde::Serialize)]
@ -182,12 +182,6 @@ impl App {
cc.egui_ctx.set_fonts(fonts); cc.egui_ctx.set_fonts(fonts);
cc.egui_ctx.style_mut(|style| {
// TODO: change color of text in TextEdit
style.visuals.widgets.noninteractive.fg_stroke =
Stroke::new(1.0, Color32::from_rgb(200, 200, 200));
});
// enable features on egui_extras to add more image types // enable features on egui_extras to add more image types
egui_extras::install_image_loaders(&cc.egui_ctx); egui_extras::install_image_loaders(&cc.egui_ctx);

View File

@ -188,7 +188,9 @@ fn format_from_style(
) -> egui::text::TextFormat { ) -> egui::text::TextFormat {
use egui::{Align, Color32, Stroke, TextStyle}; use egui::{Align, Color32, Stroke, TextStyle};
let color = if emark_style.strong || emark_style.heading { let color = if emark_style.code {
egui_style.visuals.strong_text_color() * Color32::from_rgb(0x44, 0xff, 0x44)
} else if emark_style.strong || emark_style.heading {
egui_style.visuals.strong_text_color() egui_style.visuals.strong_text_color()
} else if emark_style.quoted { } else if emark_style.quoted {
egui_style.visuals.weak_text_color() egui_style.visuals.weak_text_color()

View File

@ -56,7 +56,7 @@ impl CanvasRasterizer {
} }
pub fn clear(&mut self) { pub fn clear(&mut self) {
log::error!("clearing all tiles"); log::debug!("clearing all tiles");
self.tiles.clear(); self.tiles.clear();
self.populate_tiles(); self.populate_tiles();
} }

View File

@ -34,13 +34,18 @@ impl Preferences {
if !self.has_applied_theme { if !self.has_applied_theme {
self.has_applied_theme = true; self.has_applied_theme = true;
let mut dark_visuals = Visuals::dark();
let mut light_visuals = Visuals::light();
dark_visuals.code_bg_color = Color32::BLACK;
dark_visuals.code_bg_color = Color32::BLACK;
light_visuals.code_bg_color = Color32::WHITE;
if self.high_contrast { if self.high_contrast {
// widgets.active: color of headers in textedit // widgets.active: color of headers in textedit
// widgets.inactive: color of button labels // widgets.inactive: color of button labels
// widgets.hovered: color of hovered button labels // widgets.hovered: color of hovered button labels
// widgets.noninteractive: color of labels and normal textedit text // widgets.noninteractive: color of labels and normal textedit text
let mut dark_visuals = Visuals::dark();
let mut light_visuals = Visuals::light();
dark_visuals.widgets.noninteractive.fg_stroke.color = Color32::WHITE; dark_visuals.widgets.noninteractive.fg_stroke.color = Color32::WHITE;
dark_visuals.widgets.inactive.fg_stroke.color = Color32::WHITE; dark_visuals.widgets.inactive.fg_stroke.color = Color32::WHITE;
@ -49,13 +54,16 @@ impl Preferences {
light_visuals.widgets.noninteractive.fg_stroke.color = Color32::BLACK; light_visuals.widgets.noninteractive.fg_stroke.color = Color32::BLACK;
light_visuals.widgets.inactive.fg_stroke.color = Color32::BLACK; light_visuals.widgets.inactive.fg_stroke.color = Color32::BLACK;
light_visuals.widgets.hovered.fg_stroke.color = Color32::BLACK; light_visuals.widgets.hovered.fg_stroke.color = Color32::BLACK;
} else {
dark_visuals.widgets.noninteractive.fg_stroke.color =
Color32::from_rgb(0xaa, 0xaa, 0xaa);
light_visuals.widgets.noninteractive.fg_stroke.color =
Color32::from_rgb(0x11, 0x11, 0x11);
}
ctx.set_visuals_of(Theme::Dark, dark_visuals); ctx.set_visuals_of(Theme::Dark, dark_visuals);
ctx.set_visuals_of(Theme::Light, light_visuals); ctx.set_visuals_of(Theme::Light, light_visuals);
} else {
ctx.set_visuals_of(Theme::Dark, Visuals::dark());
ctx.set_visuals_of(Theme::Light, Visuals::light());
}
} }
} }