Tweak text colors
This commit is contained in:
10
src/app.rs
10
src/app.rs
@ -8,8 +8,8 @@ use std::{
|
||||
|
||||
use crate::{file_editor::FileEditor, folder::Folder, preferences::Preferences, util::GuiSender};
|
||||
use egui::{
|
||||
Align, Button, Color32, Context, FontData, FontDefinitions, Image, Key, Modifiers,
|
||||
PointerButton, RichText, ScrollArea, Stroke, Widget, include_image,
|
||||
Align, Button, Context, FontData, FontDefinitions, Image, Key, Modifiers, PointerButton,
|
||||
RichText, ScrollArea, Widget, include_image,
|
||||
};
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize)]
|
||||
@ -182,12 +182,6 @@ impl App {
|
||||
|
||||
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
|
||||
egui_extras::install_image_loaders(&cc.egui_ctx);
|
||||
|
||||
|
||||
@ -188,7 +188,9 @@ fn format_from_style(
|
||||
) -> egui::text::TextFormat {
|
||||
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()
|
||||
} else if emark_style.quoted {
|
||||
egui_style.visuals.weak_text_color()
|
||||
|
||||
@ -56,7 +56,7 @@ impl CanvasRasterizer {
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) {
|
||||
log::error!("clearing all tiles");
|
||||
log::debug!("clearing all tiles");
|
||||
self.tiles.clear();
|
||||
self.populate_tiles();
|
||||
}
|
||||
|
||||
@ -34,13 +34,18 @@ impl Preferences {
|
||||
if !self.has_applied_theme {
|
||||
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 {
|
||||
// widgets.active: color of headers in textedit
|
||||
// widgets.inactive: color of button labels
|
||||
// widgets.hovered: color of hovered button labels
|
||||
// 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.inactive.fg_stroke.color = Color32::WHITE;
|
||||
@ -49,13 +54,16 @@ impl Preferences {
|
||||
light_visuals.widgets.noninteractive.fg_stroke.color = Color32::BLACK;
|
||||
light_visuals.widgets.inactive.fg_stroke.color = Color32::BLACK;
|
||||
light_visuals.widgets.hovered.fg_stroke.color = Color32::BLACK;
|
||||
|
||||
ctx.set_visuals_of(Theme::Dark, dark_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());
|
||||
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::Light, light_visuals);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user