Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
color_field-3331283
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
color_field-3331283
Commits
585c83e2
Commit
585c83e2
authored
2 years ago
by
Lucas Hedding
Committed by
Nick Dickinson-Wilde
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2946795
by kala4ek, justin2pin, heddn: Default Value for Opacity is not being honoured
parent
b447acf6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/ColorHSL.php
+1
-1
1 addition, 1 deletion
src/ColorHSL.php
src/ColorHex.php
+3
-2
3 additions, 2 deletions
src/ColorHex.php
src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php
+1
-1
1 addition, 1 deletion
src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php
with
5 additions
and
4 deletions
src/ColorHSL.php
+
1
−
1
View file @
585c83e2
...
...
@@ -175,7 +175,7 @@ class ColorHSL extends ColorBase {
$g
=
round
((
$g
+
$m
)
*
255
);
$b
=
round
((
$b
+
$m
)
*
255
);
return
new
ColorRGB
(
int
val
(
$r
)
,
int
val
(
$g
)
,
int
val
(
$b
)
,
$this
->
getOpacity
());
return
new
ColorRGB
(
(
int
)
$r
,
(
int
)
$g
,
(
int
)
$b
,
$this
->
getOpacity
());
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/ColorHex.php
+
3
−
2
View file @
585c83e2
...
...
@@ -27,7 +27,7 @@ class ColorHex extends ColorBase {
* @throws \Exception
* If the color doesn't appear to be a valid hex value.
*/
public
function
__construct
(
string
$color
,
string
$opacity
)
{
public
function
__construct
(
string
$color
,
?
string
$opacity
)
{
$color
=
trim
(
strtolower
(
$color
));
if
(
str_starts_with
(
$color
,
'#'
))
{
...
...
@@ -43,7 +43,8 @@ class ColorHex extends ColorBase {
}
$this
->
color
=
hexdec
(
$color
);
$this
->
setOpacity
(
floatval
(
$opacity
));
$opacity
=
$opacity
??
'1'
;
$this
->
setOpacity
((
float
)
$opacity
);
return
$this
;
}
...
...
This diff is collapsed.
Click to expand it.
src/Plugin/Field/FieldFormatter/ColorFieldFormatterCss.php
+
1
−
1
View file @
585c83e2
...
...
@@ -309,7 +309,7 @@ class ColorFieldFormatterCss extends FormatterBase implements ContainerFactoryPl
$opacity
=
$this
->
getFieldSetting
(
'opacity'
);
$settings
=
$this
->
getSettings
();
$color_hex
=
new
ColorHex
(
$item
->
color
,
$item
->
opacity
??
'FF'
);
$color_hex
=
new
ColorHex
(
$item
->
color
,
$item
->
opacity
);
return
$opacity
&&
$settings
[
'opacity'
]
?
$color_hex
->
toRgb
()
->
toString
(
TRUE
)
...
...
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