diff --git a/frontend/public/index.html b/frontend/public/index.html index f360bc86..4999b7a6 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -133,6 +133,9 @@ + [{[ if .Theme -]}] + + [{[ end ]}] [{[ if .CSS -]}] [{[ end ]}] diff --git a/frontend/public/themes/dark.css b/frontend/public/themes/dark.css new file mode 100644 index 00000000..3fba1f70 --- /dev/null +++ b/frontend/public/themes/dark.css @@ -0,0 +1,140 @@ +:root { + --background: #121212; + --surfacePrimary: #171819; + --surfaceSecondary: #212528; + --divider: rgba(255, 255, 255, 0.12); + --icon: #ffffff; + --textPrimary: rgba(255, 255, 255, 0.87); + --textSecondary: rgba(255, 255, 255, 0.6); +} + +body { + background: var(--background); + color: var(--textPrimary); +} + +#loading { + background: var(--background); +} +#loading .spinner div { + background: var(--icon); +} + +#login { + background: var(--background); +} + +header { + background: var(--surfacePrimary); +} + +#search #input { + background: var(--surfaceSecondary); +} +#search.active #input, +#search.active .boxes { + background: var(--surfacePrimary); +} +#search.active input { + color: var(--textPrimary); +} +#search.active #result { + background: var(--background); + color: var(--textPrimary); +} +#search.active .boxes h3 { + color: var(--textPrimary); +} + +.action { + color: var(--textPrimary) !important; +} +.action i { + color: var(--icon) !important; +} +.action .counter { + border-color: var(--surfacePrimary); +} + +nav > div { + border-color: var(--divider); +} + +#breadcrumbs { + border-color: var(--divider); + color: var(--textPrimary) !important; +} +#breadcrumbs span { + color: var(--textPrimary) !important; +} + +#listing .item { + background: var(--surfacePrimary); + color: var(--textPrimary); + border-color: var(--divider) !important; +} +#listing .item i { + color: var(--icon); +} +#listing .item .modified { + color: var(--textSecondary); +} +#listing h2, +#listing.list .header span { + color: var(--textPrimary) !important; +} +#listing.list .header span { + color: var(--textPrimary); +} +#listing.list .header i { + color: var(--icon); +} +#listing.list .item.header { + background: var(--background); +} + +.card { + background: var(--surfacePrimary); + color: var(--textPrimary); +} +.button--flat:hover { + background: var(--surfaceSecondary); +} + +.card h3, +.dashboard #nav, +.dashboard p label { + color: var(--textPrimary); +} +.input { + background: var(--surfaceSecondary); + color: var(--textPrimary); +} + +.dashboard #nav li, +.collapsible { + border-color: var(--divider); +} +.collapsible > label * { + color: var(--textPrimary); +} + +.shell { + background: var(--surfacePrimary); + color: var(--textPrimary); +} + +@media (max-width: 736px) { + #file-selection { + background: var(--surfaceSecondary) !important; + } + #file-selection span { + color: var(--textPrimary) !important; + } + nav { + background: var(--surfaceSecondary) !important; + } + #dropdown { + background: var(--surfaceSecondary) !important; + } +} diff --git a/frontend/src/components/files/Editor.vue b/frontend/src/components/files/Editor.vue index 6d87a5c8..ce31348e 100644 --- a/frontend/src/components/files/Editor.vue +++ b/frontend/src/components/files/Editor.vue @@ -10,6 +10,7 @@ import buttons from '@/utils/buttons' import ace from 'ace-builds/src-min-noconflict/ace.js' import modelist from 'ace-builds/src-min-noconflict/ext-modelist.js' import 'ace-builds/webpack-resolver' +import { theme } from '@/utils/constants' export default { name: 'editor', @@ -45,6 +46,10 @@ export default { mode: modelist.getModeForPath(this.req.name).mode, wrap: true }) + + if (theme == 'dark') { + this.editor.setTheme("ace/theme/twilight"); + } }, methods: { keyEvent (event) { diff --git a/frontend/src/components/settings/Themes.vue b/frontend/src/components/settings/Themes.vue new file mode 100644 index 00000000..48a663bd --- /dev/null +++ b/frontend/src/components/settings/Themes.vue @@ -0,0 +1,18 @@ + + + \ No newline at end of file diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json index f0752511..f42be526 100644 --- a/frontend/src/i18n/en.json +++ b/frontend/src/i18n/en.json @@ -119,6 +119,11 @@ "newArchetype": "Create a new post based on an archetype. Your file will be created on content folder." }, "settings": { + "themes": { + "title": "Theme", + "light": "Light", + "dark": "Dark" + }, "instanceName": "Instance name", "brandingDirectoryPath": "Branding directory path", "documentation": "documentation", diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js index 306f460d..b4a5a5be 100644 --- a/frontend/src/utils/constants.js +++ b/frontend/src/utils/constants.js @@ -9,6 +9,7 @@ const version = window.FileBrowser.Version const logoURL = `/${staticURL}/img/logo.svg` const noAuth = window.FileBrowser.NoAuth const loginPage = window.FileBrowser.LoginPage +const theme = window.FileBrowser.Theme export { name, @@ -20,5 +21,6 @@ export { signup, version, noAuth, - loginPage + loginPage, + theme } diff --git a/frontend/src/views/settings/Global.vue b/frontend/src/views/settings/Global.vue index bd642359..a0fbfa8a 100644 --- a/frontend/src/views/settings/Global.vue +++ b/frontend/src/views/settings/Global.vue @@ -29,6 +29,11 @@ {{ $t('settings.disableExternalLinks') }}

+

+ + +

+

@@ -98,10 +103,12 @@ import { mapState } from 'vuex' import { settings as api } from '@/api' import UserForm from '@/components/settings/UserForm' import Rules from '@/components/settings/Rules' +import Themes from '@/components/settings/Themes' export default { name: 'settings', components: { + Themes, UserForm, Rules }, diff --git a/http/static.go b/http/static.go index 29239a5f..104f2d09 100644 --- a/http/static.go +++ b/http/static.go @@ -37,6 +37,7 @@ func handleWithStaticData(w http.ResponseWriter, r *http.Request, d *data, box * "LoginPage": auther.LoginPage(), "CSS": false, "ReCaptcha": false, + "Theme": d.settings.Branding.Theme, } if d.settings.Branding.Files != "" { diff --git a/settings/branding.go b/settings/branding.go index 8a835b1d..68404bbb 100644 --- a/settings/branding.go +++ b/settings/branding.go @@ -5,4 +5,5 @@ type Branding struct { Name string `json:"name"` DisableExternal bool `json:"disableExternal"` Files string `json:"files"` + Theme string `json:"theme"` }