-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
egui not respecting text color #2005
Labels
bug
Something is broken
Comments
steventrouble
changed the title
[Accessibility] Default contrast is too low
egui not respecting text color
Sep 5, 2022
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
use eframe::egui;
use egui::Color32;
use egui::FontFamily::Monospace;
use egui::FontId;
use egui::TextStyle::*;
fn main() {
let options = eframe::NativeOptions::default();
eframe::run_native(
"My egui App",
options,
Box::new(|_cc| Box::new(MyApp::default())),
);
}
struct MyApp;
impl Default for MyApp {
fn default() -> Self {
Self
}
}
impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
let mut visuals = egui::Visuals::light();
visuals.widgets.inactive.bg_fill = Color32::WHITE;
visuals.widgets.inactive.bg_stroke.color = Color32::RED;
visuals.widgets.inactive.fg_stroke.color = Color32::BLACK;
visuals.widgets.inactive.rounding = 1.0.into();
visuals.widgets.hovered.bg_fill = Color32::WHITE;
visuals.widgets.hovered.bg_stroke.color = Color32::RED;
visuals.widgets.hovered.fg_stroke.color = Color32::BLACK;
visuals.widgets.hovered.rounding = 1.0.into();
let mut style = (*ctx.style()).clone();
style.text_styles = [(Button, FontId::new(25.0, Monospace))].into();
ctx.set_style(style);
ctx.set_visuals(visuals);
egui::CentralPanel::default().show(ctx, |ui| ui.button("click me!"));
}
} @steventrouble Hi, please try this. |
@steventrouble please try latest |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When I set the text color to black (#000), the text does not turn black. Instead, it is #585858.
I'm trying to make my text darker so it meets accessibility standards:
https://webaim.org/resources/contrastchecker/?fcolor=585858&bcolor=E6E6E6
But the text isn't getting darker.
Button:
To Reproduce
Steps to reproduce the behavior:
Set the visuals to the following:
Create a button (or any widget).
Expected behavior
The text color should be black, not grey.
Desktop:
The text was updated successfully, but these errors were encountered: