Skip to content

Commit 61026e0

Browse files
committed
systray, themes
1 parent be983bb commit 61026e0

File tree

11 files changed

+92
-689
lines changed

11 files changed

+92
-689
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
*.code-workspace
77
*_templ.go
88
*.json
9-
timetracker.yaml
9+
timetracker.yaml
10+
*.syso

Taskfile.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ tasks:
1717
desc: Generate templ templates
1818
cmds:
1919
- templ generate
20-
20+
winres:
21+
desc: Make windows manifest for icon
22+
cmds:
23+
- go-winres make
2124
assets:
2225
desc: Build assets for project
2326
deps: [css, gen]
@@ -29,6 +32,6 @@ tasks:
2932
- go run .
3033
build:
3134
desc: Run the application
32-
deps: [css, gen]
35+
deps: [css, gen, winres]
3336
cmds:
3437
- go build -ldflags -H=windowsgui .

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ require (
3333
github.com/mattn/go-sqlite3 v1.14.18 // indirect
3434
github.com/mitchellh/mapstructure v1.5.0 // indirect
3535
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
36+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
3637
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
3738
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
3839
github.com/sagikazarmark/locafero v0.4.0 // indirect

go.sum

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI
254254
github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
255255
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
256256
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
257+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
258+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
257259
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
258260
github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZI=
259261
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -514,6 +516,7 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
514516
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
515517
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
516518
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
519+
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
517520
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
518521
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
519522
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=

internal/assets/css/input.css

Lines changed: 29 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -507,81 +507,14 @@ html {
507507
}
508508

509509
:root {
510-
color-scheme: light;
511-
--in: 0.7206 0.191 231.6;
512-
--su: 64.8% 0.150 160;
513-
--wa: 0.8471 0.199 83.87;
514-
--er: 0.7176 0.221 22.18;
515-
--pc: 0.89824 0.06192 275.75;
516-
--ac: 0.15352 0.0368 183.61;
517-
--inc: 0 0 0;
518-
--suc: 0 0 0;
519-
--wac: 0 0 0;
520-
--erc: 0 0 0;
521-
--rounded-box: 1rem;
522-
--rounded-btn: 0.5rem;
523-
--rounded-badge: 1.9rem;
524-
--animation-btn: 0.25s;
525-
--animation-input: .2s;
526-
--btn-focus-scale: 0.95;
527-
--border-btn: 1px;
528-
--tab-border: 1px;
529-
--tab-radius: 0.5rem;
530-
--p: 0.4912 0.3096 275.75;
531-
--s: 0.6971 0.329 342.55;
532-
--sc: 0.9871 0.0106 342.55;
533-
--a: 0.7676 0.184 183.61;
534-
--n: 0.321785 0.02476 255.701624;
535-
--nc: 0.894994 0.011585 252.096176;
536-
--b1: 1 0 0;
537-
--b2: 0.961151 0 0;
538-
--b3: 0.924169 0.00108 197.137559;
539-
--bc: 0.278078 0.029596 256.847952;
540-
}
541-
542-
@media (prefers-color-scheme: dark) {
543-
:root {
544-
color-scheme: dark;
545-
--in: 0.7206 0.191 231.6;
546-
--su: 64.8% 0.150 160;
547-
--wa: 0.8471 0.199 83.87;
548-
--er: 0.7176 0.221 22.18;
549-
--pc: 0.13138 0.0392 275.75;
550-
--sc: 0.1496 0.052 342.55;
551-
--ac: 0.14902 0.0334 183.61;
552-
--inc: 0 0 0;
553-
--suc: 0 0 0;
554-
--wac: 0 0 0;
555-
--erc: 0 0 0;
556-
--rounded-box: 1rem;
557-
--rounded-btn: 0.5rem;
558-
--rounded-badge: 1.9rem;
559-
--animation-btn: 0.25s;
560-
--animation-input: .2s;
561-
--btn-focus-scale: 0.95;
562-
--border-btn: 1px;
563-
--tab-border: 1px;
564-
--tab-radius: 0.5rem;
565-
--p: 0.6569 0.196 275.75;
566-
--s: 0.748 0.26 342.55;
567-
--a: 0.7451 0.167 183.61;
568-
--n: 0.313815 0.021108 254.139175;
569-
--nc: 0.746477 0.0216 264.435964;
570-
--b1: 0.253267 0.015896 252.417568;
571-
--b2: 0.232607 0.013807 253.100675;
572-
--b3: 0.211484 0.01165 254.087939;
573-
--bc: 0.746477 0.0216 264.435964;
574-
}
575-
}
576-
577-
[data-theme=light] {
578-
color-scheme: light;
510+
color-scheme: dark;
579511
--in: 0.7206 0.191 231.6;
580512
--su: 64.8% 0.150 160;
581513
--wa: 0.8471 0.199 83.87;
582514
--er: 0.7176 0.221 22.18;
583-
--pc: 0.89824 0.06192 275.75;
584-
--ac: 0.15352 0.0368 183.61;
515+
--pc: 0.13138 0.0392 275.75;
516+
--sc: 0.1496 0.052 342.55;
517+
--ac: 0.14902 0.0334 183.61;
585518
--inc: 0 0 0;
586519
--suc: 0 0 0;
587520
--wac: 0 0 0;
@@ -595,16 +528,15 @@ html {
595528
--border-btn: 1px;
596529
--tab-border: 1px;
597530
--tab-radius: 0.5rem;
598-
--p: 0.4912 0.3096 275.75;
599-
--s: 0.6971 0.329 342.55;
600-
--sc: 0.9871 0.0106 342.55;
601-
--a: 0.7676 0.184 183.61;
602-
--n: 0.321785 0.02476 255.701624;
603-
--nc: 0.894994 0.011585 252.096176;
604-
--b1: 1 0 0;
605-
--b2: 0.961151 0 0;
606-
--b3: 0.924169 0.00108 197.137559;
607-
--bc: 0.278078 0.029596 256.847952;
531+
--p: 0.6569 0.196 275.75;
532+
--s: 0.748 0.26 342.55;
533+
--a: 0.7451 0.167 183.61;
534+
--n: 0.313815 0.021108 254.139175;
535+
--nc: 0.746477 0.0216 264.435964;
536+
--b1: 0.253267 0.015896 252.417568;
537+
--b2: 0.232607 0.013807 253.100675;
538+
--b3: 0.211484 0.01165 254.087939;
539+
--bc: 0.746477 0.0216 264.435964;
608540
}
609541

610542
[data-theme=dark] {
@@ -640,70 +572,37 @@ html {
640572
--bc: 0.746477 0.0216 264.435964;
641573
}
642574

643-
[data-theme=cupcake] {
575+
[data-theme=emerald] {
644576
color-scheme: light;
577+
--b2: 0.93 0 0;
578+
--b3: 0.86 0 0;
645579
--in: 0.7206 0.191 231.6;
646580
--su: 64.8% 0.150 160;
647581
--wa: 0.8471 0.199 83.87;
648582
--er: 0.7176 0.221 22.18;
649-
--pc: 0.152344 0.017892 200.026556;
650-
--sc: 0.15787 0.020249 356.29965;
651-
--ac: 0.158762 0.029206 78.618794;
652-
--nc: 0.847148 0.013247 313.189598;
653583
--inc: 0 0 0;
654584
--suc: 0 0 0;
655585
--wac: 0 0 0;
656586
--erc: 0 0 0;
657587
--rounded-box: 1rem;
658-
--rounded-badge: 1.9rem;
659-
--animation-btn: 0.25s;
660-
--animation-input: .2s;
661-
--btn-focus-scale: 0.95;
662-
--border-btn: 1px;
663-
--p: 0.76172 0.089459 200.026556;
664-
--s: 0.789351 0.101246 356.29965;
665-
--a: 0.793811 0.146032 78.618794;
666-
--n: 0.235742 0.066235 313.189598;
667-
--b1: 0.977882 0.00418 56.375637;
668-
--b2: 0.939822 0.007638 61.449292;
669-
--b3: 0.915861 0.006811 53.440502;
670-
--bc: 0.235742 0.066235 313.189598;
671-
--rounded-btn: 1.9rem;
672-
--tab-border: 2px;
673-
--tab-radius: 0.7rem;
674-
}
675-
676-
[data-theme=night] {
677-
color-scheme: dark;
678-
--b2: 0.193144 0.037037 265.754874;
679-
--b3: 0.178606 0.034249 265.754874;
680-
--bc: 0.841536 0.007965 265.754874;
681-
--pc: 0.150703 0.027798 232.66148;
682-
--sc: 0.136023 0.031661 276.934902;
683-
--ac: 0.144721 0.035244 350.048739;
684-
--nc: 0.855899 0.00737 260.030984;
685-
--suc: 0.156904 0.026506 181.911977;
686-
--wac: 0.166486 0.027912 82.95003;
687-
--erc: 0.143572 0.034051 13.11834;
688-
--rounded-box: 1rem;
689588
--rounded-btn: 0.5rem;
690589
--rounded-badge: 1.9rem;
691-
--animation-btn: 0.25s;
692-
--animation-input: .2s;
693-
--btn-focus-scale: 0.95;
694590
--border-btn: 1px;
695591
--tab-border: 1px;
696592
--tab-radius: 0.5rem;
697-
--p: 0.753513 0.138989 232.66148;
698-
--s: 0.680113 0.158303 276.934902;
699-
--a: 0.723603 0.176218 350.048739;
700-
--n: 0.279495 0.036848 260.030984;
701-
--b1: 0.207682 0.039824 265.754874;
702-
--in: 0.684553 0.148062 237.25135;
703-
--inc: 0 0 0;
704-
--su: 0.78452 0.132529 181.911977;
705-
--wa: 0.832428 0.139558 82.95003;
706-
--er: 0.717858 0.170255 13.11834;
593+
--p: 0.766626 0.135433 153.450024;
594+
--pc: 0.333872 0.040618 162.240129;
595+
--s: 0.613028 0.202368 261.294233;
596+
--sc: 1 0 0;
597+
--a: 0.727725 0.149783 33.200363;
598+
--ac: 0 0 0;
599+
--n: 0.355192 0.032071 262.988584;
600+
--nc: 0.984625 0.001706 247.838921;
601+
--b1: 1 0 0;
602+
--bc: 0.355192 0.032071 262.988584;
603+
--animation-btn: 0;
604+
--animation-input: 0;
605+
--btn-focus-scale: 1;
707606
}
708607

709608
*, ::before, ::after {

internal/components/components.templ

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,24 @@ package components
33

44
import "local/timetracker/internal/database"
55
import "strconv"
6+
import "github.com/spf13/viper"
7+
import "fmt"
8+
9+
func getTheme() string {
10+
theme := viper.GetString("theme")
11+
fmt.Println(theme)
12+
if theme == "dark" {
13+
return "dark"
14+
}
15+
if theme == "light" {
16+
return "emerald"
17+
}
18+
return "dark"
19+
}
620

721
templ PageHeader(contents templ.Component) {
822
<!DOCTYPE html>
9-
<html data-theme="dark">
23+
<html data-theme={ getTheme() }>
1024
<head>
1125
<meta charset="UTF-8"/>
1226
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

0 commit comments

Comments
 (0)