Shinmera / colored

A library for dealing with colours and colour spaces
https://shinmera.github.io/colored
zlib License
13 stars 2 forks source link

Linear RGB/sRGB conversion question #2

Closed JeffreyPalmer closed 6 months ago

JeffreyPalmer commented 6 months ago

Hi!

Thanks for creating this library! I've been migrating my creative coding workflow to Common Lisp and was pleased to find it.

One question regarding the conversion between linear RGB and sRGB: It looks like you're applying a fixed gamma conversion instead of using something like the equation here: https://www.nayuki.io/page/srgb-transform-library, but I'm not really an expert on how this library works yet so I might be missing something. If not, was this an intentional choice, or is this something that you would consider adding to the library? I could try my hand at creating a PR, if so.

Thanks again!

Shinmera commented 6 months ago

The conversion is based on the typical trick that's done for games to convert between linear and srgb. The equations you linked to should be more accurate and I'd welcome a PR implementing them!

JeffreyPalmer commented 6 months ago

Do you care if I remove the existing sRGB/RGB conversion functions, or would you prefer that they be kept around as an option? If so, I'm not sure how to override the convert method for both types of conversion (I'm a CL noob, lol).

Shinmera commented 6 months ago

No, just replace them.

JeffreyPalmer commented 6 months ago

I believe that this should work, but I did something to my environment yesterday and now I'm unable to run the package tests. When I try to run the tests for the package I get the following:

* (asdf:test-system :colored)
; compiling file "/Users/jeff/.quicklisp/local-projects/colored/test.lisp" (written 21 MAY 2024 03:04:22 PM):

; wrote /Users/jeff/.cache/common-lisp/sbcl-2.4.4-macosx-x64/Users/jeff/.quicklisp/local-projects/colored/test-tmpAR3FSGEY.fasl
; compilation finished in 0:00:00.035

debugger invoked on a UNDEFINED-FUNCTION @54600B04 in thread
#<THREAD tid=259 "main thread" RUNNING {1003F080A3}>:
  The function ORG.SHIRAKUMO.ALLOY.COLORED::%RGB is undefined.

If you happen to have any ideas as to what might be causing this please let me know; it's driving me crazy.

Regardless, thanks for the package!

Shinmera commented 6 months ago

Tests run through fine on my system. The only idea I have is that you might have stale fasls somewhere?