Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pleroma-fe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Pleroma
pleroma-fe
Commits
552d13a0
Commit
552d13a0
authored
5 years ago
by
HJ
Browse files
Options
Downloads
Patches
Plain Diff
better fallback for transparent colors
parent
8536f3cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1074
Update master with 2.0.0
,
!1037
Themes v3 Part 1 "2.1" codenamed "One step for themes, a giant burder for code reviewers"
Pipeline
#21868
failed
5 years ago
Stage: lint
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/services/theme_data/theme_data.service.js
+58
-7
58 additions, 7 deletions
src/services/theme_data/theme_data.service.js
with
58 additions
and
7 deletions
src/services/theme_data/theme_data.service.js
+
58
−
7
View file @
552d13a0
...
...
@@ -35,8 +35,8 @@ export const DEFAULT_OPACITY = {
export
const
SLOT_INHERITANCE
=
{
bg
:
{
depends
:
[],
prior
ity
:
1
,
opac
ity
:
'
bg
'
opac
ity
:
'
bg
'
,
prior
ity
:
1
},
fg
:
{
depends
:
[],
...
...
@@ -272,6 +272,9 @@ export const SLOT_INHERITANCE = {
variant
:
'
btnPressed
'
,
textColor
:
true
},
btnPressedPanel
:
{
depends
:
[
'
btnPressed
'
]
},
btnPressedPanelText
:
{
depends
:
[
'
btnPanelText
'
],
layer
:
'
btnPanel
'
,
...
...
@@ -490,8 +493,13 @@ export const getOpacitySlot = (
inheritance
=
SLOT_INHERITANCE
,
getDeps
=
getDependencies
)
=>
{
if
(
v
.
opacity
===
null
)
return
if
(
v
.
opacity
)
return
v
.
opacity
const
value
=
typeof
v
===
'
string
'
?
{
depends
:
v
.
startsWith
(
'
--
'
)
?
[
v
.
substring
(
2
)]
:
[]
}
:
v
if
(
value
.
opacity
===
null
)
return
if
(
value
.
opacity
)
return
v
.
opacity
const
findInheritedOpacity
=
(
val
)
=>
{
const
depSlot
=
val
.
depends
[
0
]
if
(
depSlot
===
undefined
)
return
...
...
@@ -505,8 +513,40 @@ export const getOpacitySlot = (
return
null
}
}
if
(
v
.
depends
)
{
return
findInheritedOpacity
(
v
)
if
(
value
.
depends
)
{
return
findInheritedOpacity
(
value
)
}
}
export
const
getLayerSlot
=
(
k
,
v
,
inheritance
=
SLOT_INHERITANCE
,
getDeps
=
getDependencies
)
=>
{
const
value
=
typeof
v
===
'
string
'
?
{
depends
:
v
.
startsWith
(
'
--
'
)
?
[
v
.
substring
(
2
)]
:
[]
}
:
v
if
(
LAYERS
[
k
])
return
k
if
(
value
.
layer
===
null
)
return
if
(
value
.
layer
)
return
v
.
layer
const
findInheritedLayer
=
(
val
)
=>
{
const
depSlot
=
val
.
depends
[
0
]
if
(
depSlot
===
undefined
)
return
const
dependency
=
getDeps
(
depSlot
,
inheritance
)[
0
]
if
(
dependency
===
undefined
)
return
if
(
dependency
.
layer
||
dependency
===
null
)
{
return
dependency
.
layer
}
else
if
(
dependency
.
depends
)
{
return
findInheritedLayer
(
dependency
)
}
else
{
return
null
}
}
if
(
value
.
depends
)
{
return
findInheritedLayer
(
value
)
}
}
...
...
@@ -550,9 +590,20 @@ export const getColors = (sourceColors, sourceOpacity, mod) => SLOT_ORDERED.redu
// Color is defined in source color
let
targetColor
=
sourceColor
if
(
targetColor
===
'
transparent
'
)
{
// We take only layers below current one
const
layers
=
getLayers
(
getLayerSlot
(
key
,
value
),
key
,
value
.
opacity
||
key
,
colors
,
opacity
).
slice
(
0
,
-
1
)
targetColor
=
{
// TODO: try to use alpha-blended background here
...
convert
(
'
#FF00FF
'
).
rgb
,
...
alphaBlendLayers
(
convert
(
'
#FF00FF
'
).
rgb
,
layers
),
a
:
0
}
}
else
if
(
typeof
sourceColor
===
'
string
'
&&
sourceColor
.
startsWith
(
'
--
'
))
{
...
...
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