diff --git a/cmd/config.go b/cmd/config.go index 8e2d3548..51771158 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -41,6 +41,7 @@ func addConfigFlags(flags *pflag.FlagSet) { flags.String("recaptcha.secret", "", "ReCaptcha secret") flags.String("branding.name", "", "replace 'File Browser' by this name") + flags.String("branding.color", "", "set theme_color of Manifest") flags.String("branding.files", "", "path to directory with images and custom styles") flags.Bool("branding.disableExternal", false, "disable external links such as GitHub links") } @@ -131,6 +132,7 @@ func printSettings(ser *settings.Server, set *settings.Settings, auther auth.Aut fmt.Fprintf(w, "\tName:\t%s\n", set.Branding.Name) fmt.Fprintf(w, "\tFiles override:\t%s\n", set.Branding.Files) fmt.Fprintf(w, "\tDisable external links:\t%t\n", set.Branding.DisableExternal) + fmt.Fprintf(w, "\tColor:\t%s\n", set.Branding.Color) fmt.Fprintln(w, "\nServer:") fmt.Fprintf(w, "\tLog:\t%s\n", ser.Log) fmt.Fprintf(w, "\tPort:\t%s\n", ser.Port) diff --git a/cmd/config_set.go b/cmd/config_set.go index e959bc97..058f0d6b 100644 --- a/cmd/config_set.go +++ b/cmd/config_set.go @@ -51,6 +51,8 @@ you want to change. Other options will remain unchanged.`, set.Shell = convertCmdStrToCmdArray(mustGetString(flags, flag.Name)) case "branding.name": set.Branding.Name = mustGetString(flags, flag.Name) + case "branding.color": + set.Branding.Color = mustGetString(flags, flag.Name) case "branding.disableExternal": set.Branding.DisableExternal = mustGetBool(flags, flag.Name) case "branding.files": diff --git a/frontend/public/index.html b/frontend/public/index.html index adab4cb8..fc5a6609 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -51,7 +51,7 @@ "start_url": window.location.origin + window.FileBrowser.BaseURL, "display": "standalone", "background_color": "#ffffff", - "theme_color": "#455a64" + "theme_color": window.FileBrowser.Color || "#455a64" } const stringManifest = JSON.stringify(dynamicManifest); diff --git a/http/static.go b/http/static.go index 91a2ab95..3529513b 100644 --- a/http/static.go +++ b/http/static.go @@ -29,6 +29,7 @@ func handleWithStaticData(w http.ResponseWriter, _ *http.Request, d *data, fSys data := map[string]interface{}{ "Name": d.settings.Branding.Name, "DisableExternal": d.settings.Branding.DisableExternal, + "Color": d.settings.Branding.Color, "BaseURL": d.server.BaseURL, "Version": version.Version, "StaticURL": path.Join(d.server.BaseURL, "/static"), diff --git a/settings/branding.go b/settings/branding.go index 68404bbb..6bf6a77a 100644 --- a/settings/branding.go +++ b/settings/branding.go @@ -6,4 +6,5 @@ type Branding struct { DisableExternal bool `json:"disableExternal"` Files string `json:"files"` Theme string `json:"theme"` + Color string `json:"color"` }