mirror of
https://github.com/librekeys/picoforge.git
synced 2026-07-28 08:01:19 -07:00
feat(ui): Restore original shadcn-ui based zinc theme
This commit is contained in:
+14
-1
@@ -1,9 +1,11 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use gpui::*;
|
||||
use gpui_component::Root;
|
||||
use gpui_component::{Theme, ThemeMode};
|
||||
use gpui_component::{Theme, ThemeMode, ThemeSet};
|
||||
use ui::rootview::ApplicationRoot;
|
||||
|
||||
mod device;
|
||||
@@ -19,6 +21,17 @@ fn main() {
|
||||
gpui_component::init(cx);
|
||||
Theme::change(ThemeMode::Dark, None, cx);
|
||||
|
||||
let theme_json = include_str!("../themes/picoforge-zinc.json");
|
||||
if let Ok(theme_set) = serde_json::from_str::<ThemeSet>(theme_json) {
|
||||
for config in theme_set.themes {
|
||||
if config.mode == ThemeMode::Dark {
|
||||
let config = Rc::new(config);
|
||||
Theme::global_mut(cx).apply_config(&config);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cx.activate(true);
|
||||
|
||||
let mut window_size = size(px(1344.0), px(756.0));
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use crate::device::types::DeviceMethod;
|
||||
use crate::ui::colors;
|
||||
use crate::ui::components::button::PFIconButton;
|
||||
use crate::ui::types::{ActiveView, GlobalDeviceState};
|
||||
use gpui::*;
|
||||
@@ -59,6 +58,8 @@ impl<V: 'static> AppSidebar<V> {
|
||||
let collapsed = self.collapsed;
|
||||
let state = self.state.clone();
|
||||
|
||||
let sidebar_bg = cx.theme().sidebar;
|
||||
let sidebar_fg = cx.theme().sidebar_foreground;
|
||||
let border_color = cx.theme().sidebar_border;
|
||||
let muted_foreground = cx.theme().muted_foreground;
|
||||
|
||||
@@ -67,7 +68,7 @@ impl<V: 'static> AppSidebar<V> {
|
||||
|
||||
v_flex()
|
||||
.h_full()
|
||||
.bg(rgb(colors::zinc::ZINC900))
|
||||
.bg(sidebar_bg)
|
||||
.border_r_1()
|
||||
.border_color(border_color)
|
||||
.w(width)
|
||||
@@ -75,7 +76,7 @@ impl<V: 'static> AppSidebar<V> {
|
||||
let header = h_flex()
|
||||
.w_full()
|
||||
.items_center()
|
||||
.bg(rgb(colors::zinc::ZINC900))
|
||||
.bg(sidebar_bg)
|
||||
// .border_r_1()
|
||||
// .border_color(border_color)
|
||||
.pt_4();
|
||||
@@ -114,7 +115,7 @@ impl<V: 'static> AppSidebar<V> {
|
||||
.opacity(text_opacity)
|
||||
.child("PicoForge")
|
||||
.font_weight(gpui::FontWeight::EXTRA_BOLD)
|
||||
.text_color(rgb(colors::zinc::ZINC100)),
|
||||
.text_color(sidebar_fg),
|
||||
)
|
||||
} else {
|
||||
None
|
||||
@@ -127,7 +128,7 @@ impl<V: 'static> AppSidebar<V> {
|
||||
.h_auto()
|
||||
.w_full()
|
||||
.flex_grow()
|
||||
.bg(rgb(colors::zinc::ZINC900))
|
||||
.bg(sidebar_bg)
|
||||
.border_color(gpui::transparent_white())
|
||||
.child(
|
||||
SidebarGroup::new("Menu").child(
|
||||
|
||||
+5
-8
@@ -1,12 +1,9 @@
|
||||
use crate::device::io;
|
||||
use crate::ui::components::sidebar::AppSidebar;
|
||||
use crate::ui::types::{ActiveView, GlobalDeviceState};
|
||||
use crate::ui::{
|
||||
colors,
|
||||
views::{
|
||||
about::AboutView, config::ConfigView, home::HomeView, logs::LogsView,
|
||||
passkeys::PasskeysEvent, passkeys::PasskeysView, security::SecurityView,
|
||||
},
|
||||
use crate::ui::views::{
|
||||
about::AboutView, config::ConfigView, home::HomeView, logs::LogsView, passkeys::PasskeysEvent,
|
||||
passkeys::PasskeysView, security::SecurityView,
|
||||
};
|
||||
|
||||
use gpui::prelude::*;
|
||||
@@ -141,11 +138,11 @@ impl Render for ApplicationRoot {
|
||||
v_flex()
|
||||
.size_full()
|
||||
.child(
|
||||
TitleBar::new().bg(rgba(colors::zinc::ZINC950)).child(
|
||||
TitleBar::new().bg(cx.theme().title_bar).child(
|
||||
h_flex()
|
||||
.w_full()
|
||||
.justify_between()
|
||||
.bg(rgba(colors::zinc::ZINC950))
|
||||
.bg(cx.theme().title_bar)
|
||||
.items_center()
|
||||
.cursor(gpui::CursorStyle::OpenHand)
|
||||
.child(
|
||||
|
||||
@@ -91,6 +91,7 @@ impl AboutView {
|
||||
.child(
|
||||
Button::new("github_btn")
|
||||
.outline()
|
||||
.bg(rgb(0x222225))
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
|
||||
@@ -576,6 +576,7 @@ impl PasskeysView {
|
||||
.child(
|
||||
PFButton::new(if pin_set { "Change PIN" } else { "Set PIN" })
|
||||
.id("change-pin-btn")
|
||||
.with_colors(rgb(0x222225), rgb(0x2a2a2d), rgb(0x333336))
|
||||
.on_click(listener),
|
||||
)
|
||||
}
|
||||
@@ -615,6 +616,7 @@ impl PasskeysView {
|
||||
.child(
|
||||
PFButton::new("Update Minimum Length")
|
||||
.id("update-min-len-btn")
|
||||
.with_colors(rgb(0x222225), rgb(0x2a2a2d), rgb(0x333336))
|
||||
.disabled(!pin_set)
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
this.open_min_pin_length_dialog(window, cx);
|
||||
|
||||
@@ -12,9 +12,14 @@ pub struct SecurityView;
|
||||
|
||||
impl SecurityView {
|
||||
pub fn build<V: 'static>(cx: &mut Context<V>) -> impl IntoElement {
|
||||
let (fg, muted_fg, border) = {
|
||||
let (fg, muted_fg, border, card_bg) = {
|
||||
let theme = cx.theme();
|
||||
(theme.foreground, theme.muted_foreground, theme.border)
|
||||
(
|
||||
theme.foreground,
|
||||
theme.muted_foreground,
|
||||
theme.border,
|
||||
theme.secondary,
|
||||
)
|
||||
};
|
||||
|
||||
let destructive_red = rgb(0xef4444);
|
||||
@@ -33,7 +38,7 @@ impl SecurityView {
|
||||
.gap_2()
|
||||
.border_1()
|
||||
.border_color(destructive_border)
|
||||
.bg(rgb(crate::ui::colors::zinc::ZINC900))
|
||||
.bg(card_bg)
|
||||
.rounded_md()
|
||||
.child(
|
||||
h_flex()
|
||||
@@ -63,7 +68,7 @@ impl SecurityView {
|
||||
.w_full()
|
||||
.border_1()
|
||||
.border_color(destructive_border)
|
||||
.bg(rgb(crate::ui::colors::zinc::ZINC900))
|
||||
.bg(card_bg)
|
||||
.rounded_xl()
|
||||
.overflow_hidden()
|
||||
.child(
|
||||
|
||||
@@ -0,0 +1,228 @@
|
||||
{
|
||||
"$schema": "https://github.com/longbridge/gpui-component/raw/refs/heads/main/.theme-schema.json",
|
||||
"name": "PicoForge Zinc",
|
||||
"author": "Suyog Tandel",
|
||||
"url": "https://ui.shadcn.com/colors",
|
||||
"themes": [
|
||||
{
|
||||
"name": "PicoForge Zinc Light",
|
||||
"mode": "light",
|
||||
"radius": 10,
|
||||
"radius.lg": 12,
|
||||
"colors": {
|
||||
"accent.background": "#f4f4f5",
|
||||
"accent.foreground": "#27272a",
|
||||
"accordion.background": "#ffffff",
|
||||
"background": "#ffffff",
|
||||
"border": "#e4e4e7",
|
||||
"group_box.background": "#f4f4f5",
|
||||
"group_box.foreground": "#18181b",
|
||||
"caret": "#18181b",
|
||||
"danger.background": "#ef4444",
|
||||
"danger.active.background": "#dc2626",
|
||||
"danger.foreground": "#fef2f2",
|
||||
"danger.hover.background": "#ef4444e6",
|
||||
"description_list_label.background": "#f4f4f5",
|
||||
"description_list_label.foreground": "#18181b",
|
||||
"drag_border": "#3b82f6",
|
||||
"drop_target.background": "#3b82f640",
|
||||
"foreground": "#18181b",
|
||||
"info.background": "#0ea5e9",
|
||||
"info.active.background": "#0284c7",
|
||||
"info.foreground": "#f0f9ff",
|
||||
"info.hover.background": "#0ea5e9e6",
|
||||
"input.border": "#e4e4e7",
|
||||
"link.foreground": "#18181b",
|
||||
"link.active.foreground": "#18181b",
|
||||
"link.hover.foreground": "#3f3f46",
|
||||
"list.background": "#ffffff",
|
||||
"list.active.background": "#bfdbfe33",
|
||||
"list.active.border": "#60a5fa",
|
||||
"list.even.background": "#fafafa",
|
||||
"list.head.background": "#fafafa",
|
||||
"list.hover.background": "#f4f4f5",
|
||||
"muted.background": "#f4f4f5",
|
||||
"muted.foreground": "#71717a",
|
||||
"panel.background": "#f4f4f5",
|
||||
"popover.background": "#ffffff",
|
||||
"popover.foreground": "#18181b",
|
||||
"primary.background": "#27272a",
|
||||
"primary.active.background": "#18181b",
|
||||
"primary.foreground": "#fafafa",
|
||||
"primary.hover.background": "#3f3f46",
|
||||
"progress_bar.background": "#27272a",
|
||||
"ring": "#a1a1aa",
|
||||
"scrollbar.background": "#fafafa00",
|
||||
"scrollbar.thumb.background": "#a1a1aae6",
|
||||
"scrollbar.thumb.hover.background": "#a1a1aa",
|
||||
"secondary.background": "#f4f4f5",
|
||||
"secondary.active.background": "#e4e4e7",
|
||||
"secondary.foreground": "#27272a",
|
||||
"secondary.hover.background": "#ededef",
|
||||
"selection.background": "#55a0fc",
|
||||
"sidebar.background": "#fafafa",
|
||||
"sidebar.accent.background": "#f4f4f5",
|
||||
"sidebar.accent.foreground": "#27272a",
|
||||
"sidebar.border": "#e4e4e7",
|
||||
"sidebar.foreground": "#18181b",
|
||||
"sidebar.primary.background": "#27272a",
|
||||
"sidebar.primary.foreground": "#fafafa",
|
||||
"skeleton.background": "#f4f4f5",
|
||||
"slider.bar.background": "#27272a",
|
||||
"slider.thumb.background": "#ffffff",
|
||||
"success.background": "#22c55e",
|
||||
"success.active.background": "#16a34a",
|
||||
"success.foreground": "#f9fafb",
|
||||
"success.hover.background": "#22c55ee6",
|
||||
"bullish.background": "#22c55e",
|
||||
"bearish.background": "#ef4444",
|
||||
"switch.background": "#d4d4d8",
|
||||
"tab.background": "#00000000",
|
||||
"tab.active.background": "#ffffff",
|
||||
"tab.active.foreground": "#18181b",
|
||||
"tab_bar.background": "#f4f4f5",
|
||||
"tab_bar.segmented.background": "#f4f4f5",
|
||||
"tab.foreground": "#3f3f46",
|
||||
"table.background": "#ffffff",
|
||||
"table.active.background": "#bfdbfe33",
|
||||
"table.active.border": "#60a5fa",
|
||||
"table.even.background": "#fafafa",
|
||||
"table.head.background": "#fafafa",
|
||||
"table.head.foreground": "#71717a",
|
||||
"table.hover.background": "#f4f4f5",
|
||||
"table.row.border": "#e4e4e7b3",
|
||||
"tiles.background": "#fafafa",
|
||||
"title_bar.background": "#fafafa",
|
||||
"title_bar.border": "#e4e4e7",
|
||||
"warning.background": "#eab308",
|
||||
"warning.active.background": "#ca8a04",
|
||||
"warning.hover.background": "#eab308e6",
|
||||
"warning.foreground": "#f9fafb",
|
||||
"overlay": "#0000000d",
|
||||
"window.border": "#e4e4e7",
|
||||
"base.red": "#ef4444",
|
||||
"base.red.light": "#fecaca",
|
||||
"base.green": "#22c55e",
|
||||
"base.green.light": "#bbf7d0",
|
||||
"base.blue": "#3b82f6",
|
||||
"base.blue.light": "#bfdbfe",
|
||||
"base.yellow": "#eab308",
|
||||
"base.yellow.light": "#fef08a",
|
||||
"base.magenta": "#9333ea",
|
||||
"base.magenta.light": "#e9d5ff",
|
||||
"base.cyan": "#06b6d4",
|
||||
"base.cyan.light": "#cffafe"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "PicoForge Zinc Dark",
|
||||
"mode": "dark",
|
||||
"radius": 10,
|
||||
"radius.lg": 12,
|
||||
"colors": {
|
||||
"accent.background": "#27272a",
|
||||
"accent.foreground": "#fafafa",
|
||||
"accordion.background": "#09090b",
|
||||
"background": "#09090b",
|
||||
"border": "#ffffff1a",
|
||||
"group_box.background": "#18181b",
|
||||
"group_box.foreground": "#fafafa",
|
||||
"caret": "#fafafa",
|
||||
"danger.background": "#7f1d1d",
|
||||
"danger.active.background": "#661717",
|
||||
"danger.foreground": "#fef2f2",
|
||||
"danger.hover.background": "#8b2020",
|
||||
"description_list_label.background": "#18181b",
|
||||
"description_list_label.foreground": "#fafafa",
|
||||
"drag_border": "#3b82f6",
|
||||
"drop_target.background": "#3b82f619",
|
||||
"foreground": "#fafafa",
|
||||
"info.background": "#0c4a6e",
|
||||
"info.active.background": "#0a3c5a",
|
||||
"info.foreground": "#f0f9ff",
|
||||
"info.hover.background": "#0d5077",
|
||||
"input.border": "#ffffff26",
|
||||
"link.foreground": "#fafafa",
|
||||
"link.active.foreground": "#d4d4d8",
|
||||
"link.hover.foreground": "#ffffff",
|
||||
"list.background": "#09090b",
|
||||
"list.active.background": "#1e40af33",
|
||||
"list.active.border": "#1d4ed8",
|
||||
"list.even.background": "#18181bcc",
|
||||
"list.head.background": "#18181bcc",
|
||||
"list.hover.background": "#27272a",
|
||||
"muted.background": "#27272a",
|
||||
"muted.foreground": "#a1a1aa",
|
||||
"panel.background": "#18181b",
|
||||
"popover.background": "#18181b",
|
||||
"popover.foreground": "#fafafa",
|
||||
"primary.background": "#e4e4e7",
|
||||
"primary.active.background": "#d4d4d8",
|
||||
"primary.foreground": "#27272a",
|
||||
"primary.hover.background": "#ededef",
|
||||
"progress_bar.background": "#e4e4e7",
|
||||
"ring": "#71717a",
|
||||
"scrollbar.background": "#09090b00",
|
||||
"scrollbar.thumb.background": "#52525be6",
|
||||
"scrollbar.thumb.hover.background": "#52525b",
|
||||
"secondary.background": "#18181b",
|
||||
"secondary.active.background": "#27272a",
|
||||
"secondary.foreground": "#fafafa",
|
||||
"secondary.hover.background": "#1f1f22",
|
||||
"selection.background": "#1d4ed8",
|
||||
"sidebar.background": "#18181b",
|
||||
"sidebar.accent.background": "#27272a",
|
||||
"sidebar.accent.foreground": "#fafafa",
|
||||
"sidebar.border": "#ffffff1a",
|
||||
"sidebar.foreground": "#fafafa",
|
||||
"sidebar.primary.background": "#fafafa",
|
||||
"sidebar.primary.foreground": "#09090b",
|
||||
"skeleton.background": "#18181b",
|
||||
"slider.bar.background": "#e4e4e7",
|
||||
"slider.thumb.background": "#09090b",
|
||||
"success.background": "#14532d",
|
||||
"success.active.background": "#104224",
|
||||
"success.foreground": "#f0fdf4",
|
||||
"success.hover.background": "#165b32",
|
||||
"bullish.background": "#22c55e",
|
||||
"bearish.background": "#ef4444",
|
||||
"switch.background": "#52525b",
|
||||
"tab.background": "#00000000",
|
||||
"tab.active.background": "#09090b",
|
||||
"tab.active.foreground": "#fafafa",
|
||||
"tab_bar.background": "#18181b",
|
||||
"tab_bar.segmented.background": "#18181b",
|
||||
"tab.foreground": "#d4d4d8",
|
||||
"table.background": "#09090b",
|
||||
"table.active.background": "#1e40af33",
|
||||
"table.active.border": "#1d4ed8",
|
||||
"table.even.background": "#18181bcc",
|
||||
"table.head.background": "#18181bcc",
|
||||
"table.head.foreground": "#71717a",
|
||||
"table.hover.background": "#27272a",
|
||||
"table.row.border": "#27272ab3",
|
||||
"tiles.background": "#18181b",
|
||||
"title_bar.background": "#09090b",
|
||||
"title_bar.border": "#ffffff1a",
|
||||
"warning.background": "#713f12",
|
||||
"warning.active.background": "#5b320f",
|
||||
"warning.foreground": "#fefce8",
|
||||
"warning.hover.background": "#7b4414",
|
||||
"overlay": "#ffffff08",
|
||||
"window.border": "#27272a",
|
||||
"base.red": "#ef4444",
|
||||
"base.red.light": "#fecaca",
|
||||
"base.green": "#22c55e",
|
||||
"base.green.light": "#bbf7d0",
|
||||
"base.blue": "#3b82f6",
|
||||
"base.blue.light": "#bfdbfe",
|
||||
"base.yellow": "#eab308",
|
||||
"base.yellow.light": "#fef08a",
|
||||
"base.magenta": "#9333ea",
|
||||
"base.magenta.light": "#e9d5ff",
|
||||
"base.cyan": "#06b6d4",
|
||||
"base.cyan.light": "#cffafe"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user