Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ilja
pleroma-fe
Commits
b65a29aa
Commit
b65a29aa
authored
8 years ago
by
lain
Browse files
Options
Downloads
Patches
Plain Diff
Dynamic style setting.
parent
1687d7de
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
index.html
+0
-1
0 additions, 1 deletion
index.html
src/main.js
+4
-0
4 additions, 0 deletions
src/main.js
src/services/style_setter/style_setter.js
+45
-0
45 additions, 0 deletions
src/services/style_setter/style_setter.js
static/css/solarized-light.css
+0
-5
0 additions, 5 deletions
static/css/solarized-light.css
with
49 additions
and
6 deletions
index.html
+
0
−
1
View file @
b65a29aa
...
...
@@ -5,7 +5,6 @@
<title>
Pleroma
</title>
<link
rel=
"stylesheet"
href=
"/static/font/css/fontello.css"
>
<link
rel=
"stylesheet"
href=
"/static/font/css/animation.css"
>
<link
rel=
"stylesheet"
href=
"/static/css/solarized-light.css"
>
</head>
<body>
<div
id=
"app"
></div>
...
...
This diff is collapsed.
Click to expand it.
src/main.js
+
4
−
0
View file @
b65a29aa
...
...
@@ -15,6 +15,8 @@ import apiModule from './modules/api.js'
import
VueTimeago
from
'
vue-timeago
'
import
StyleSetter
from
'
./services/style_setter/style_setter.js
'
Vue
.
use
(
Vuex
)
Vue
.
use
(
VueRouter
)
Vue
.
use
(
VueTimeago
,
{
...
...
@@ -58,3 +60,5 @@ new Vue({
template
:
'
<App/>
'
,
components
:
{
App
}
})
StyleSetter
.
setStyle
(
'
/static/css/solarized-light.css
'
)
This diff is collapsed.
Click to expand it.
src/services/style_setter/style_setter.js
0 → 100644
+
45
−
0
View file @
b65a29aa
const
setStyle
=
(
href
)
=>
{
/***
What's going on here?
I want to make it easy for admins to style this application. To have
a good set of default themes, I chose the system from base16
(https://chriskempson.github.io/base16/) to style all elements. They
all have the base00..0F classes. So the only thing an admin needs to
do to style Pleroma is to change these colors in that one css file.
Some default things (body text color, link color) need to be set dy-
namically, so this is done here by waiting for the stylesheet to be
loaded and then creating an element with the respective classes.
It is a bit weird, but should make life for admins somewhat easier.
***/
const
head
=
document
.
head
const
body
=
document
.
body
body
.
style
.
display
=
'
none
'
const
cssEl
=
document
.
createElement
(
'
link
'
)
cssEl
.
setAttribute
(
'
rel
'
,
'
stylesheet
'
)
cssEl
.
setAttribute
(
'
href
'
,
href
)
head
.
appendChild
(
cssEl
)
const
setDynamic
=
()
=>
{
const
baseEl
=
document
.
createElement
(
'
div
'
)
baseEl
.
setAttribute
(
'
class
'
,
'
base05
'
)
const
base05Color
=
window
.
getComputedStyle
(
baseEl
).
getPropertyValue
(
'
color
'
)
baseEl
.
setAttribute
(
'
class
'
,
'
base08
'
)
const
base08Color
=
window
.
getComputedStyle
(
baseEl
).
getPropertyValue
(
'
color
'
)
const
styleEl
=
document
.
createElement
(
'
style
'
)
head
.
appendChild
(
styleEl
)
const
styleSheet
=
styleEl
.
sheet
styleSheet
.
insertRule
(
`a { color:
${
base08Color
}
`
,
'
index-max
'
)
styleSheet
.
insertRule
(
`body { color:
${
base05Color
}
`
,
'
index-max
'
)
styleSheet
.
insertRule
(
`.base05-border { color:
${
base05Color
}
`
,
'
index-max
'
)
body
.
style
.
display
=
'
initial
'
}
cssEl
.
addEventListener
(
'
load
'
,
setDynamic
)
}
const
StyleSetter
=
{
setStyle
}
export
default
StyleSetter
This diff is collapsed.
Click to expand it.
static/css/solarized-light.css
+
0
−
5
View file @
b65a29aa
...
...
@@ -31,8 +31,3 @@
.base0D
{
color
:
#268bd2
;
}
.base0E
{
color
:
#6c71c4
;
}
.base0F
{
color
:
#d33682
;
}
.base05-border
{
color
:
#586e75
;
}
a
{
color
:
#dc322f
;
}
/* base08 */
body
{
color
:
#586e75
;
}
/* base05 */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment