wgui: use dark mode
This commit is contained in:
@@ -52,6 +52,7 @@ impl Frontend {
|
|||||||
let globals = WguiGlobals::new(
|
let globals = WguiGlobals::new(
|
||||||
Box::new(assets::Asset {}),
|
Box::new(assets::Asset {}),
|
||||||
wgui::globals::Defaults {
|
wgui::globals::Defaults {
|
||||||
|
dark_mode: true,
|
||||||
text_color: drawing::Color::new(1.0, 1.0, 1.0, 1.0),
|
text_color: drawing::Color::new(1.0, 1.0, 1.0, 1.0),
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<layout>
|
<layout>
|
||||||
<elements>
|
<elements>
|
||||||
<rectangle
|
<rectangle
|
||||||
color="#AAAAAA"
|
color="#888888"
|
||||||
width="1000" height="500" min_width="1000" min_height="500"
|
width="1000" height="500" min_width="1000" min_height="500"
|
||||||
gap="4" flex_direction="column"
|
gap="4" flex_direction="column"
|
||||||
overflow_y="scroll">
|
overflow_y="scroll">
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<CheckBox text="i'm checked by default" checked="1" />
|
<CheckBox text="i'm checked by default" checked="1" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label text="custom attrib test, you should see size rectangles below, each of them in R, G and B (if TESTBED is generic)" />
|
<label text="custom attrib test, you should see size rectangles below, each of them in R, G and B (if TESTBED is not set)" />
|
||||||
<div flex_direction="row" gap="8">
|
<div flex_direction="row" gap="8">
|
||||||
<label text="lighter:" />
|
<label text="lighter:" />
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,13 @@ impl TestbedAny {
|
|||||||
pub fn new(name: &str, listeners: &mut EventListenerCollection<(), ()>) -> anyhow::Result<Self> {
|
pub fn new(name: &str, listeners: &mut EventListenerCollection<(), ()>) -> anyhow::Result<Self> {
|
||||||
let path = format!("gui/{name}.xml");
|
let path = format!("gui/{name}.xml");
|
||||||
|
|
||||||
let globals = WguiGlobals::new(Box::new(assets::Asset {}), Default::default())?;
|
let globals = WguiGlobals::new(
|
||||||
|
Box::new(assets::Asset {}),
|
||||||
|
wgui::globals::Defaults {
|
||||||
|
dark_mode: true,
|
||||||
|
text_color: wgui::drawing::Color::new(1.0, 1.0, 1.0, 1.0),
|
||||||
|
},
|
||||||
|
)?;
|
||||||
|
|
||||||
let (layout, state) = wgui::parser::new_layout_from_assets(
|
let (layout, state) = wgui::parser::new_layout_from_assets(
|
||||||
listeners,
|
listeners,
|
||||||
|
|||||||
@@ -59,7 +59,13 @@ impl TestbedGeneric {
|
|||||||
pub fn new(listeners: &mut EventListenerCollection<(), ()>) -> anyhow::Result<Self> {
|
pub fn new(listeners: &mut EventListenerCollection<(), ()>) -> anyhow::Result<Self> {
|
||||||
const XML_PATH: &str = "gui/various_widgets.xml";
|
const XML_PATH: &str = "gui/various_widgets.xml";
|
||||||
|
|
||||||
let globals = WguiGlobals::new(Box::new(assets::Asset {}), Default::default())?;
|
let globals = WguiGlobals::new(
|
||||||
|
Box::new(assets::Asset {}),
|
||||||
|
wgui::globals::Defaults {
|
||||||
|
text_color: wgui::drawing::Color::new(1.0, 1.0, 1.0, 1.0),
|
||||||
|
dark_mode: true,
|
||||||
|
},
|
||||||
|
)?;
|
||||||
|
|
||||||
let extra = ParseDocumentExtra {
|
let extra = ParseDocumentExtra {
|
||||||
on_custom_attribs: Some(Box::new(move |par| {
|
on_custom_attribs: Some(Box::new(move |par| {
|
||||||
|
|||||||
@@ -386,6 +386,7 @@ pub fn construct<U1, U2>(
|
|||||||
WidgetLabelParams {
|
WidgetLabelParams {
|
||||||
content: Translation::default(),
|
content: Translation::default(),
|
||||||
style: TextStyle {
|
style: TextStyle {
|
||||||
|
color: Some(drawing::Color::new(0.0, 0.0, 0.0, 0.75)), // always black
|
||||||
weight: Some(FontWeight::Bold),
|
weight: Some(FontWeight::Bold),
|
||||||
align: Some(HorizontalAlign::Center),
|
align: Some(HorizontalAlign::Center),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ use std::{
|
|||||||
use crate::{assets::AssetProvider, drawing, i18n::I18n};
|
use crate::{assets::AssetProvider, drawing, i18n::I18n};
|
||||||
|
|
||||||
pub struct Defaults {
|
pub struct Defaults {
|
||||||
|
pub dark_mode: bool,
|
||||||
pub text_color: drawing::Color,
|
pub text_color: drawing::Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Defaults {
|
impl Default for Defaults {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
dark_mode: true,
|
||||||
text_color: drawing::Color::new(0.0, 0.0, 0.0, 1.0),
|
text_color: drawing::Color::new(0.0, 0.0, 0.0, 1.0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,7 @@
|
|||||||
<rectangle padding="8" gap="8" round="100%" color="~bg_color_active" justify_content="center" align_items="center">
|
<rectangle padding="8" gap="8" round="100%" color="~bg_color_active" justify_content="center" align_items="center">
|
||||||
<label size="18" translation="BAR.OPACITY" color="~text_color" />
|
<label size="18" translation="BAR.OPACITY" color="~text_color" />
|
||||||
<Slider width="150" height="24" min_value="0" max_value="100" value="100" />
|
<Slider width="150" height="24" min_value="0" max_value="100" value="100" />
|
||||||
<label size="18" translation="BAR.ADDITIVE" color="~text_color" />
|
<CheckBox translation="BAR.ADDITIVE" color="~text_color" />
|
||||||
<sprite color="~device_color" width="20" height="20" src="bar/checkbox-checked.svg" />
|
|
||||||
</rectangle>
|
</rectangle>
|
||||||
</div>
|
</div>
|
||||||
</elements>
|
</elements>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use glam::Affine3A;
|
use glam::Affine3A;
|
||||||
use idmap::IdMap;
|
use idmap::IdMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use smallvec::{smallvec, SmallVec};
|
use smallvec::{SmallVec, smallvec};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use wgui::{
|
use wgui::{
|
||||||
gfx::WGfx, globals::WguiGlobals, renderer_vk::context::SharedContext as WSharedContext,
|
gfx::WGfx, globals::WguiGlobals, renderer_vk::context::SharedContext as WSharedContext,
|
||||||
@@ -97,6 +97,7 @@ impl AppState {
|
|||||||
wgui_globals: WguiGlobals::new(
|
wgui_globals: WguiGlobals::new(
|
||||||
Box::new(gui::asset::GuiAsset {}),
|
Box::new(gui::asset::GuiAsset {}),
|
||||||
wgui::globals::Defaults {
|
wgui::globals::Defaults {
|
||||||
|
dark_mode: true,
|
||||||
text_color: wgui::drawing::Color::new(1.0, 1.0, 1.0, 1.0),
|
text_color: wgui::drawing::Color::new(1.0, 1.0, 1.0, 1.0),
|
||||||
},
|
},
|
||||||
)?,
|
)?,
|
||||||
|
|||||||
Reference in New Issue
Block a user