Skip to content

Commit

Permalink
Merge branch 'main' of github.com:propensive/iridescence
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Jun 6, 2024
2 parents 76a3faa + 31769af commit daf9e2c
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ as long as caution is taken to avoid a mismatch between the project's stability
level and the required stability and maintainability of your own project.

Iridescence is designed to be _small_. Its entire source code currently consists
of 442 lines of code.
of 489 lines of code.

## Building

Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Cielab.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import anticipation.*
import hypotenuse.*

object Cielab:
given (using ColorProfile) => Cielab is RgbColor = _.srgb.rgb24.asInt
given (using ColorProfile) => Cielab is Chromatic = _.srgb.rgb24.asInt

case class Cielab(l: Double, a: Double, b: Double):
def srgb(using ColorProfile): Srgb = xyz.srgb
Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Cmy.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import scala.util.chaining.*
import anticipation.*

object Cmy:
given Cmy is RgbColor = _.srgb.rgb24.asInt
given Cmy is Chromatic = _.srgb.rgb24.asInt

case class Cmy(cyan: Double, magenta: Double, yellow: Double):
def srgb: Srgb = Srgb((1 - cyan), (1 - magenta), (1 - yellow))
Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Cmyk.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import scala.util.chaining.*
import anticipation.*

object Cmyk:
given Cmyk is RgbColor = _.srgb.rgb24.asInt
given Cmyk is Chromatic = _.srgb.rgb24.asInt

case class Cmyk(cyan: Double, magenta: Double, yellow: Double, key: Double):
def srgb: Srgb = cmy.srgb
Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Hsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import scala.util.chaining.*
import anticipation.*

object Hsl:
given Hsl is RgbColor = _.srgb.rgb24.asInt
given Hsl is Chromatic = _.srgb.rgb24.asInt

case class Hsl(hue: Double, saturation: Double, lightness: Double):
def saturate: Hsv = Hsv(hue, 1, lightness)
Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Hsv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import scala.util.chaining.*
import anticipation.*

object Hsv:
given Hsv is RgbColor = _.srgb.rgb24.asInt
given Hsv is Chromatic = _.srgb.rgb24.asInt

case class Hsv(hue: Double, saturation: Double, value: Double):
def saturate: Hsv = Hsv(hue, 1, value)
Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Rgb12Opaque.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object Rgb12Opaque:

object Rgb12:
given underlying: Underlying[Rgb12, Int] = ###
given Rgb12 is RgbColor = _.srgb.rgb24.asInt
given Rgb12 is Chromatic = _.srgb.rgb24.asInt

def apply(red: Int, green: Int, blue: Int): Rgb12 = ((red&15) << 8) + ((green&15) << 4) + (blue&15)

Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Rgb24Opaque.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object Rgb24Opaque:

object Rgb24:
given underlying: Underlying[Rgb24, Int] = ###
given Rgb24 is RgbColor = _.asInt
given Rgb24 is Chromatic = _.asInt

def apply(red: Int, green: Int, blue: Int): Rgb24 = ((red&255) << 16) + ((green&255) << 8) + (blue&255)
def apply(packedInt: Int): Rgb24 = packedInt & 0x00ffffff
Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Rgb32Opaque.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object Rgb32Opaque:

object Rgb32:
given underlying: Underlying[Rgb32, Int] = ###
given Rgb32 is RgbColor = _.srgb.rgb24.asInt
given Rgb32 is Chromatic = _.srgb.rgb24.asInt

def apply(red: Int, green: Int, blue: Int): Rgb32 = ((red&1023) << 22) + ((green&4095) << 10) + (blue&1023)

Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Srgb.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import rudiments.*


object Srgb:
given Srgb is RgbColor = _.rgb24.asInt
given Srgb is Chromatic = _.rgb24.asInt

case class Srgb(red: Double, green: Double, blue: Double):
def css: Text = Text(s"rgb(${(red*255).toInt}, ${(green*255).toInt}, ${(blue*255).toInt})")
Expand Down
2 changes: 1 addition & 1 deletion src/core/iridescence.Xyz.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import anticipation.*
import hypotenuse.*

object Xyz:
given Xyz is RgbColor = _.srgb.rgb24.asInt
given Xyz is Chromatic = _.srgb.rgb24.asInt

case class Xyz(x: Double, y: Double, z: Double):
def luminescence: Double = y
Expand Down

0 comments on commit daf9e2c

Please sign in to comment.