Skip to content

Commit

Permalink
Merge pull request #199 from lucyydotp/main
Browse files Browse the repository at this point in the history
fix: Correct text shadow colour
  • Loading branch information
kezz authored Apr 2, 2024
2 parents 21910ef + 5ad34ef commit 404b691
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,10 @@ public val TEXT_COLOR_RENDER_HOOK: ComponentRenderHook = { component ->
component.color()?.let { color ->
addStyle("color: ${color.asHexString()}")

val hsv = color.asHSV()
val h = (hsv.h() * 360.0f).toInt()
val s = (hsv.s() * 100.0f).toInt()
val l = ((hsv.v() * 100.0f) / 4f).toInt()

// text shadows use hsl with lightness divided by 4 and floored
addStyle("text-shadow: 3px 3px hsl($h, $s%, $l%)")
val r = color.red() / 4.0
val g = color.green() / 4.0
val b = color.blue() / 4.0
addStyle("text-shadow: 3px 3px rgb($r, $g, $b)")
}

true
Expand Down

0 comments on commit 404b691

Please sign in to comment.