Skip to content

Commit

Permalink
fix: embed theme
Browse files Browse the repository at this point in the history
  • Loading branch information
jgillich committed Jan 21, 2024
1 parent c051927 commit e490ead
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions style/style.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package style

import (
"embed"
)

//go:embed *.css
var FS embed.FS
File renamed without changes.
4 changes: 3 additions & 1 deletion ui/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/diamondburned/gotk4/pkg/gio/v2"
"github.com/diamondburned/gotk4/pkg/gtk/v4"
"github.com/jgillich/kubegio/state"
"github.com/jgillich/kubegio/style"
)

const ApplicationName = "kubegtk"
Expand Down Expand Up @@ -54,7 +55,8 @@ func NewApplication(version string) (*Application, error) {
})

provider := gtk.NewCSSProvider()
provider.LoadFromPath("theme.css")
theme, _ := style.FS.ReadFile("theme.css")
provider.LoadFromData(string(theme))
gtk.StyleContextAddProviderForDisplay(gdk.DisplayGetDefault(), provider, gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

return &application, nil
Expand Down

0 comments on commit e490ead

Please sign in to comment.