Releases: tommyettinger/colorful-gdx
0.5.0 "Better Than Okay"
It's been a whole two days since the last release, but this adds a complete new feature: the Oklab color space, recently released by Björn Ottosson. It's similar to IPT and to YCwCm, but should have better smooth gradients between colors and should be easier to measure the perceptual difference between colors. It's also slightly easier to compute than IPT_HQ. It's not without its quirks; like IPT_HQ, 50% gray doesn't have 0.5 lightness/intensity (it's 0.55 for IPT_HQ, and 0.63 for Oklab), and the A and B chromatic channels have a rather small range. That last quirk is really more of a feature because it makes comparing the distance between colors in Oklab easier -- multiply L by 0.5 for each color, then get the Euclidean distance between the two colors (the standard differenceL * differenceL + differenceA * differenceA + differenceB * differenceB
, with a square root if you need it to be a valid metric, or no square root if you only care about whether it's more or less than one other distance). IPT takes a lot of fiddling to get its color differences closer to accurate, and the closest I've found multiplies I by 3 instead of L by 0.5, but is otherwise similar (and probably not as good). The same APIs are available for Oklab as IPT_HQ, including a color-description system in SimplePalette
. JARs are provided here for colorful, which depends on libGDX 1.9.13, and colorful-pure, which depends on jdkgdxds 0.0.4 or higher. You probably want colorful, if you're here, and don't need colorful-pure unless you know you don't want the libGDX dependency.
0.4.2 "Eight-fold Realignment"
This release fixes the one from yesterday, 0.4.1; that previous version had an issue that made its ColorfulBatch
classes incompatible with projects using Java 8 to compile. The issue seems to be cleared up for good; the technical part of it is that Java 8 and earlier had compatible APIs for Buffer
and ShortBuffer
, but Java 9 broke that compatibility, which stayed broken in all later versions. It's easy to fix by casting any ShortBuffer
s to Buffer
when code needs to call Buffer
methods on them; this only happens on two lines in each ColorfulBatch
, and shouldn't affect user code. A lot of documentation was improved here in this release. One shader in Shaders
(the IPT_HQ one) changed slightly, to match the similar shader in the ipt_hq ColorfulBatch
class (now I know 50% gray has 0.55 intensity in IPT_HQ, and the ColorfulBatch
already used that as the middle point, but the one in Shaders
didn't until now). This doesn't include the Oklab color space yet; my implementation of it is still a work in progress, but it should be in the next release.
0.4.1 "The Approx-i-mat-or"
This release mostly adds small features to SimplePalette's matching, and changes the name of one color so you can actually get a color with the description "brown" instead of calling it "sepia". There's the ability to find the best description to match an IPT_HQ color with a String description, which is useful if any code might handle colors purely as Strings at some point. Importantly for descriptions, you can describe lightening, darkening, dulling, and enriching with adjectives like "light", "lighter", "lightest", and now the new "lightmost" (ignore that it isn't a real word...). Really, the adjectives just check whether there's 2, 3, or 4 letters after "light", "dark", "rich", or "dull", matching those cases to "-er", "-est", or "-most" as the highest level.
There's a few updates to dependencies. Gradle is 6.8, which is generally good to keep up-to-date for point releases. The colorful-pure
module depends on jdkgdxds
0.0.4, the latest stable version of those data structures. The colorful
module now depends on libGDX 1.9.13, instead of 1.9.12, which removes the need for some of the trig approximations in TrigTools (they're the same in libGDX now). If you used asin(float) or acos(float), use MathUtils instead of TrigTools. If you used sinDegrees(float) or cosDegrees(float), MathUtils already had sinDeg(float) and cosDeg(float) with even higher precision (and probably speed).
0.4.0 "On Wine-Dark Seas"
This is a somewhat different release, because we now have two groups of jar: colorful, which depends on libGDX 1.9.12 or newer and Java 7 or newer, and colorful-pure, which depends on jdkgdxds (currently 0.0.3, but it's mostly code isolated from libGDX and should be about as stable) and Java 8 or newer. You usually would need only colorful, and only in a project that uses libGDX, but some cases can use color manipulation code that doesn't depend on graphics, which is where colorful-pure is useful. A typical project will only use either colorful or colorful-pure in a given module, but could easily use one on a server and the other on a client.
Feature-wise, there's a SimplePalette
in the ipt_hq
package, and it allows describing colors by combining color names with a limited set of adjectives. There's also enrich()
and dullen()
methods in the ipt
, ipt_hq
, and ycwcm
versions of ColorTools
, which affect saturation, and more methods for handling the gamut in those ColorTools
classes as well.
I think the color description technique should be more useful than the previous named colors in Palette
, especially since there's only 50 named colors to think about in SimplePalette
as opposed to 256 in Palette
.
If you need to get the JARs for jdkgdxds (only needed for colorful-pure), they are here: https://github.com/tommyettinger/jdkgdxds/releases/tag/v0.0.3
If you need to get the JARs for libGDX (only needed for colorful)... I wish you well on your journey, though I think you'd probably have a better time using Gradle.
0.3.1 "High-Quality Qualia"
This release adds a few small convenience methods to most color spaces, but most importantly adds a somewhat-new color space: IPT_HQ. Short for "Intensity-Protan-Tritan, High-Quality," it uses the same 3 channels as the existing IPT color space, but this new one doesn't omit any of the steps in Ebner and Fairchild's paper introducing IPT (the older IPT does omit two key steps that IPT_HQ performs). This means IPT_HQ gamma-corrects RGBA inputs and outputs (with a gamma of 2.0, as a compromise between the common 1.8 and 2.2 that also benefits from a fast square root function when removing the gamma), and it has an exponential step where it raises 3 internal values to the 0.43 power (or to the 1.0/0.43
, preserving sign). These steps aren't as lightning-fast as the older, simplified IPT, which actually combines the two matrix multiplications in IPT_HQ into one, but the difference in how IPT and IPT_HQ calculate lightness is significant. If you look for outliers in the simplified IPT color table, where all the early values are supposed to be similarly dark, and then do the same in the IPT_HQ color table, you may notice "Red" and "Blue" in the simplified table stick out as much brighter than their neighbors, but there's nothing but dark colors early on in the HQ table.
IPT_HQ supports all the same operations IPT does, except for the obscure ColorTools.fromHSI()
and ColorTools.subrandomColor()
; it has a ColorfulBatch
and ColorfulSprite
class that can be used as stand-ins for IPT. Shaders
has been updated to have an IPT_HQ shader, as well. If you currently use IPT, it might make sense to try changing the package you import from com.github.tommyettinger.colorful.ipt
to com.github.tommyettinger.colorful.ipt_hq
, and see if you notice a difference in performance or quality.
0.3.0 "In Threes"
This is a fairly big release! The different color spaces are organized into their own packages now, with almost identical APIs except for the ColorTools
class in each. To continue using the previous API, you can use Shaders in the same way, or change to the com.github.tommyettinger.colorful.ycwcm
package for ColorfulBatch, ColorfulSprite, Palette, and ColorTools. You can also use com.github.tommyettinger.colorful.ipt
or the new com.github.tommyettinger.colorful.rgb
to use those color spaces, which are discussed in the README. In practice, YCwCm does surprisingly well considering its simple formulas. Some of the tests used both IPT and YCwCm for generating palettes, with arguably better results using YCwCm. IPT does seem to handle interpolation between colors better, especially if they have comparable intensity/lightness. RGB is more familiar, but doesn't offer much for aesthetic choices in tinting.
0.2.2 "Psytrance Special"
This release has mostly shader changes, including several that allow nostalgic hue-rotation effects. I'm starting to add IPT-related code, and I really like the IPT color space now. Some breaking changes are planned for the next release, though they should be limited for the most part to package changes for existing code.
0.2.0 with extra color modifiers
The main new feature of this release is ColorfulBatch and the code that works with it, like ColorfulSprite. Before, you could set a color on a SpriteBatch, which would make additive adjustments to chromatic warmth and chromatic mildness, as well as multiplicative adjustments to luma and alpha. Now with ColorfulBatch, you can also make multiplicative adjustments to warmth and mildness (treating them as centered around 0.0, you can multiply them individually by anywhere from 0.0 to 2.0), additive adjustments to luma, and some different kinds of modification to contrast (either making mid-range colors less distinct with low contrast, or making light colors lighter and dark colors darker with high contrast). The color you can set on a ColorfulBatch now affects the additive luma, warmth, and mildness plus the multiplicative alpha. There's now also a "tweak" you can set on a ColorfulBatch that affects the multiplicative luma, warmth, and mildness, plus the contrast adjustment. Tweaking the warmth and mildness to low values (near 0.0 for both) makes the image grayscale or close to it; tweaking them to high values oversaturates the image. If the warmth and mildness tweaks are both 0.0 and you set a color on the batch as well, then instead of grayscale you can produce a "green-scale" or "purple-scale" image by setting the color to green or purple. ColorfulSprite is like libGDX's Sprite class but allows setting a tweak per-sprite as well as a color.
0.1.0 Initial Release
This release has a small but complete set of color-editing features. It includes shader code in Shaders.java
(and convenience methods that make using that code directly unnecessary), predefined packed-float colors in Palette.java
, and quite a lot of methods for manipulating those colors as floats in FloatColors.java
. Using the Maven Central dependency is recommended, and Gradle and Maven can both depend on this library using that repository.
Gradle dependency:
implementation 'com.github.tommyettinger:colorful:0.1.0'
Gradle dependency if also using GWT to make an HTML application:
implementation 'com.github.tommyettinger:colorful:0.1.0:sources'
And also for GWT, in your application's .gwt.xml
file (usually GdxDefinition.gwt.xml
)
<inherits name="com.github.tommyettinger.colorful.colorful" />
If you don't use Gradle, here's the Maven dependency:
<dependency>
<groupId>com.github.tommyettinger</groupId>
<artifactId>colorful</artifactId>
<version>0.1.0</version>
</dependency>
If you don't use Gradle or Maven, there are jars for this release here.