forked from 1b-agent/opencadstudio-upstream
style(icons): unify theme-aware palette
This commit is contained in:
1 parent
3024869de0
commit
0237652963
101 files changed
+293
-318
No files matched your search
+12
-3
@@ -346,13 +346,19 @@ fn semantic_color<'a>(
|
||||
token: &[u8],
|
||||
colors: &'a SemanticColors,
|
||||
) -> Option<&'a [u8; 7]> {
|
||||
if is_one_of(token, &["#e0e0e0", "#eeeeee", "#ffffff", "#e1e1e1"]) {
|
||||
if is_one_of(
|
||||
token,
|
||||
&["#b4b6b9", "#e0e0e0", "#eeeeee", "#ffffff", "#e1e1e1"],
|
||||
) {
|
||||
Some(&colors.text)
|
||||
} else if is_one_of(token, &["#cccccc", "#bdbdbd", "#aaaaaa"]) {
|
||||
Some(&colors.secondary_strong)
|
||||
} else if is_one_of(
|
||||
token,
|
||||
&["#888888", "#888", "#9e9e9e", "#90a4ae", "#78909c", "#7a7a7a"],
|
||||
&[
|
||||
"#888888", "#888", "#9e9e9e", "#90a4ae", "#78909c", "#7a7a7a",
|
||||
"#777777",
|
||||
],
|
||||
) {
|
||||
Some(&colors.secondary)
|
||||
} else if is_one_of(
|
||||
@@ -365,7 +371,10 @@ fn semantic_color<'a>(
|
||||
Some(&colors.secondary_weak)
|
||||
} else if is_one_of(token, &["#1a1a1a"]) {
|
||||
Some(&colors.background)
|
||||
} else if is_one_of(token, &["#4cc9f0", "#4bc8f0", "#4a9eff", "#0099e5"]) {
|
||||
} else if is_one_of(
|
||||
token,
|
||||
&["#6db7ed", "#4cc9f0", "#4bc8f0", "#4a9eff", "#0099e5"],
|
||||
) {
|
||||
Some(&colors.primary)
|
||||
} else if is_one_of(token, &["#1565c0"]) {
|
||||
Some(&colors.primary_strong)
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::modules::IconKind;
|
||||
use crate::scene::model::wire_model::WireModel;
|
||||
use crate::ui::dock::{DockMsg, PanelId};
|
||||
use iced::widget::canvas::{Frame, Path, Program, Stroke};
|
||||
use iced::widget::{button, canvas, column, container, mouse_area, row, scrollable, svg, text, text_input, tooltip};
|
||||
use iced::widget::{button, canvas, column, container, mouse_area, row, scrollable, text, text_input, tooltip};
|
||||
use iced::{Background, Border, Color, Element, Fill, Length, Theme};
|
||||
|
||||
const TOOL_H: f32 = 22.0;
|
||||
@@ -355,10 +355,7 @@ fn block_card<'a>(palette: &'a BlockPalette, block: &'a BlockEntry) -> Element<'
|
||||
fn icon_button<'a>(icon: IconKind, msg: BlockPaletteMsg) -> Element<'a, Message> {
|
||||
let icon_el: Element<'_, Message> = match icon {
|
||||
IconKind::Glyph(s) => text(s).size(15).color(Color::WHITE).into(),
|
||||
IconKind::Svg(bytes) => svg(svg::Handle::from_memory(bytes))
|
||||
.width(Length::Fixed(TOOL_H))
|
||||
.height(Length::Fixed(TOOL_H))
|
||||
.into(),
|
||||
IconKind::Svg(bytes) => crate::ui::icons::semantic(bytes, TOOL_H),
|
||||
};
|
||||
button(icon_el)
|
||||
.on_press(Message::BlockPalette(msg))
|
||||
|
||||
Reference in new issue
Block a user