Skip to content
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

[Bug] Light Theme Detection Broken #2408

Open
caoccao opened this issue Sep 16, 2024 · 1 comment
Open

[Bug] Light Theme Detection Broken #2408

caoccao opened this issue Sep 16, 2024 · 1 comment

Comments

@caoccao
Copy link

caoccao commented Sep 16, 2024

I'm building an application on Windows 10 x86_64 with light theme set. However, the application always shows the dark theme and I failed to find a way of correcting it.

image

The registry is as follows.

image

The settings is as follows.

image

@caoccao
Copy link
Author

caoccao commented Sep 16, 2024

Update

I pointed the dependency to the latest source code. It's now resolved.

[dependencies]
# druid = "0.8.3"
druid = { path = "../druid/druid" }

image

Furthermore, I implemented a simple light theme based on the built-in dark theme as follows.

fn main() {
  // ...
  druid::AppLauncher::with_window(window)
    .configure_env(set_light_theme)
    .launch(())
    .expect("Failed to launch application");
}

fn set_light_theme(env: &mut druid::Env, _: &()) {
  env.set(
    druid::theme::WINDOW_BACKGROUND_COLOR,
    druid::Color::rgb8(0xFF - 0x29, 0xFF - 0x29, 0xFF - 0x29),
  );
  env.set(
    druid::theme::TEXT_COLOR,
    druid::Color::rgb8(0xFF - 0xf0, 0xFF - 0xf0, 0xFF - 0xea),
  );
  env.set(
    druid::theme::DISABLED_TEXT_COLOR,
    druid::Color::rgb8(0xFF - 0xa0, 0xFF - 0xa0, 0xFF - 0x9a),
  );
  env.set(
    druid::theme::PLACEHOLDER_COLOR,
    druid::Color::rgb8(0xFF - 0x80, 0xFF - 0x80, 0xFF - 0x80),
  );
  env.set(
    druid::theme::PRIMARY_LIGHT,
    druid::Color::rgb8(0xFF - 0x5c, 0xFF - 0xc4, 0xFF - 0xff),
  );
  env.set(
    druid::theme::PRIMARY_DARK,
    druid::Color::rgb8(0xFF - 0x00, 0xFF - 0x8d, 0xFF - 0xdd),
  );
  env.set(
    druid::theme::BACKGROUND_LIGHT,
    druid::Color::rgb8(0xFF - 0x3a, 0xFF - 0x3a, 0xFF - 0x3a),
  );
  env.set(
    druid::theme::BACKGROUND_DARK,
    druid::Color::rgb8(0xFF - 0x31, 0xFF - 0x31, 0xFF - 0x31),
  );
  env.set(
    druid::theme::FOREGROUND_LIGHT,
    druid::Color::rgb8(0xFF - 0xf9, 0xFF - 0xf9, 0xFF - 0xf9),
  );
  env.set(
    druid::theme::FOREGROUND_DARK,
    druid::Color::rgb8(0xFF - 0xbf, 0xFF - 0xbf, 0xFF - 0xbf),
  );
  env.set(
    druid::theme::DISABLED_FOREGROUND_LIGHT,
    druid::Color::rgb8(0xFF - 0x89, 0xFF - 0x89, 0xFF - 0x89),
  );
  env.set(
    druid::theme::DISABLED_FOREGROUND_DARK,
    druid::Color::rgb8(0xFF - 0x6f, 0xFF - 0x6f, 0xFF - 0x6f),
  );
  env.set(
    druid::theme::BUTTON_LIGHT,
    druid::Color::rgb8(0xFF - 0x21, 0xFF - 0x21, 0xFF - 0x21),
  );
  env.set(druid::theme::BUTTON_DARK, druid::Color::rgb8(0x99, 0x99, 0x99));
  env.set(
    druid::theme::BORDER_DARK,
    druid::Color::rgb8(0xFF - 0x3a, 0xFF - 0x3a, 0xFF - 0x3a),
  );
  env.set(
    druid::theme::BORDER_LIGHT,
    druid::Color::rgb8(0xFF - 0xa1, 0xFF - 0xa1, 0xFF - 0xa1),
  );
  env.set(
    druid::theme::SELECTION_TEXT_COLOR,
    druid::Color::rgb8(0xFF - 0x00, 0xFF - 0x00, 0xFF - 0x00),
  );
  env.set(
    druid::theme::SCROLLBAR_COLOR,
    druid::Color::rgb8(0xFF - 0xff, 0xFF - 0xff, 0xFF - 0xff),
  );
  env.set(
    druid::theme::SCROLLBAR_BORDER_COLOR,
    druid::Color::rgb8(0xFF - 0x77, 0xFF - 0x77, 0xFF - 0x77),
  );
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant