Skip to content

Commit

Permalink
Use new hex method
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Sep 4, 2023
1 parent 9ad4b57 commit 469ddef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/conversions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ object Rgb24Opaque:

def hex: Text = Text:
IArray(red, green, blue).foldLeft("#"): (acc, c) =>
acc+(Integer.toHexString(c).nn.pipe { s => if s.length < 2 then "0"+s else s })
acc+(c.hex.pipe { s => if s.s.length < 2 then "0"+s else s })

object Rgb32Opaque:
opaque type Rgb32 = Int
Expand Down Expand Up @@ -124,7 +124,7 @@ object Rgb12Opaque:
def red: Int = (color >> 8)&15
def green: Int = (color >> 4)&15
def blue: Int = color&15
def hex: Text = Text("#"+IArray(red, green, blue).map(Integer.toHexString(_).nn).mkString)
def hex: Text = Text("#"+IArray(red, green, blue).map(_.hex).mkString)
def srgb: Srgb = Srgb(red/15.0, green/15.0, blue/15.0)

export Rgb12Opaque.Rgb12
Expand Down

0 comments on commit 469ddef

Please sign in to comment.