Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iro.js 5.0 discussion #83

Closed
jaames opened this issue Sep 24, 2019 · 67 comments
Closed

iro.js 5.0 discussion #83

jaames opened this issue Sep 24, 2019 · 67 comments

Comments

@jaames
Copy link
Owner

jaames commented Sep 24, 2019

What a wild year! iro.js hit 500 stars on Github, over 1000 NPM installs per week, and was featured on a number of web publications such as Creative Bloq, Codrops and JS Weekly!

I've been thinking a lot about what the next steps for this project might look like now that it's finally stable and fitting most people's requirements pretty well. I figured it would be worth sharing my ideas for discussion:

  • I'd like to provide official iro.js components for popular frontend frameworks, namely React and Vue. I think the best way to tackle this would be to split off core functionality (things like color conversion) into a separate "iro-core" package that is shared between various UI implementations for specific frameworks. These components would have the benefit of being much more lightweight, performant and easy to work with than hacky wrappers around iro.js, and of course there can also still be a standalone version like there is currently.
  • Svelte has matured a lot recently, and it seems like a good time to investigate whether it's worth using it for the standalone version instead of Preact. Wasn't worth it, trying Preact X instead.
  • A lot of people like iro.js for its color wheel, but what if other colorpicker types (such as the common hue-saturation square) were available, with the same frictionless API?
  • An option to choose a vertical layout has been requested for a long time, it's probably time to make an effort to implement that. Pull request Support vertical sliders #85 adds a global layoutDirection option, this will be merged after the Typescript + Preact X ports are completed
  • The typescript port was making good progress, and I think it could perhaps be used as a base for the new iro-core package.
  • I intend to redesign the iro.js.org landing page with more examples, features, and a "getting started" guide. It would also be nice to have a live codepen-style editor so that people can play with the library alongside the documentation.
  • I've noticed that there's quite a few people who are using iro.js to control lighting, which is really cool! I'd like to make a plugin for some lighting-specific utilities and UI components for working with kelvin scale colors, since no other javascript color pickers seem to be targeting that. See [feature-request] kelvin scale colors #69 for more info
  • It would be nice to have a proper set of usage examples here on github as well as codepen
  • Custom layouts need to be easier to use and better documented. This feature is definitely a candidate for a few examples too.
  • Overall, no major deprecations to the current featureset, but will have to be careful about plugins that add extra UI functionality if I go ahead with the split core idea.

I think this would take iro.js to the next level and make it one of the best damn color picker libraries out there. I welcome everybody's opinions though!

@rjsachse
Copy link

rjsachse commented Oct 3, 2019

i would really like the kelvin scale to be implemented. i am designing a app now to control led lights and this would be a added bonus. also might b able to add it to the esp8266 milight hub

@jaames
Copy link
Owner Author

jaames commented Oct 14, 2019

Svelte has matured a lot recently, and it seems like a good time to investigate whether it's worth using it for the standalone version instead of Preact.

Small update: I've made a semi-working Svelte port of the standalone version of iro.js. I'm not convinced that it's worth going forward with this idea:

  • I estimate that the final bundle size of iro.min.js is going to be about the same as the current version (around 21 kB).
  • Svelte introduces some slightly weird custom syntax which might not be familiar to most JS devs, and that could deter people from contributing code. I know the current JSX code isn't exactly "vanilla", but I think more devs will have familiarity with it given the popularity of frameworks like React, etc
  • Svelte doesn't really add any benefit to the overall code quality.

I'm going to investigate updating the codebase to make use of new Preact X features and see how that works out instead :)

@jaames
Copy link
Owner Author

jaames commented Oct 15, 2019

An option to choose a vertical layout has been requested for a long time, it's probably time to make an effort to implement that

Pull request #85 adds the groundwork for this via a global layoutDirection prop. This will be merged into iro.js after the move Typescript and Preact X is done :)

@jaames
Copy link
Owner Author

jaames commented Oct 15, 2019

The typescript port was making good progress, and I think it could perhaps be used as a base for the new iro-core package.

I made some pretty good progress with this today! The Typescript port is complete, although it needs a bit of polish, and I think I may eventually move the build process over to microbundle to simplify that a bit.

I've also been thinking a lot about how the "split-core" idea could work. My initial plan was to separate all of the code that wasn't directly related to the UI (e.g. color conversion) into an "iro-core" package and leave the UI implementation ambiguous, although on second thought I think it's also sensible to expose some generic UI utilities (like some methods to get the handle position for a slider given a specific color, or getting the orientation of a hue wheel when given specific options, etc). This would make it a lot easier for different UI implementations to remain consistent, and a nice added benefit is that all these methods could be easily tested with the current automated test setup!

@jaames
Copy link
Owner Author

jaames commented Oct 17, 2019

I made some significant progress with the split core milestone! You can see the new iro-core package at https://github.com/jaames/iro-core

This will act as a base set of functionality thats shared across multiple UI implementations, including the current standalone version of iro.js and any future components for specific frameworks like React or Vue :)

@DanielPeinhopf
Copy link

Would be great to also support multiple thumbs with numbers for choosing multiple colors on one picker.
This could be usefull for animations of LED lighting. :)

@jaames
Copy link
Owner Author

jaames commented Oct 20, 2019

@DanielPeinhopf Thanks for the input! I can see how picking multiple colors at once might be useful, I'll have to think about how to implement that though :)

@jaames
Copy link
Owner Author

jaames commented Oct 20, 2019

A lot of people like iro.js for its color wheel, but what if other colorpicker types (such as the common hue-saturation square) were available, with the same frictionless API?

Also, I just implemented an optional hue-saturation square to see how it would fit with the rest of the picker. This means iro.js could be made into the same type of color picker you see elsewhere.

Screenshot 2019-10-21 at 00 52 24

It doesn't add too much extra code (<1kb), but I'm not sure if anyone is desperate to have this as an option.

Would it be useful?

@jcesarmobile
Copy link
Contributor

Have you looked at stencil?
It uses jsx too and it’s supposed to make it easy to export a component for angular and react

@jaames
Copy link
Owner Author

jaames commented Oct 21, 2019

@jcesarmobile Stencil is neat, I've used it before for an unrelated project

My only real complaint is that it lazy-loads extra polyfill scripts, since my motivation for creating iro.js came from wanting a colorpicker library that could be dropped into a project as a single script without any extra jQuery / images / css / etc, I feel like it wouldn't be suitable

I might consider it again in the future, their fall 2019 roadmap looks promising :)

@jaames
Copy link
Owner Author

jaames commented Oct 24, 2019

Taking a short break from code to mock up a new design for the iro.js.org landing page. The current one is pretty minimal and doesn't really show what iro.js can do very well. I decided I want to put more focus on being a bit more flashy and visually demonstrating what sets iro.js apart from other javascript color pickers.

I also think it's important to have a basic setup guide on the initial landing page now, especially when there's going to be three separate packages (iro.js, iro-react and iro-vue). Users will be able to toggle between packages to show setup information for the one that's most relevant to their needs.

I welcome any feedback on this preview! Just note that it's definitely not 100% finished yet :)

Desktop HD

@DanielPeinhopf
Copy link

I love it. Cant wait to see it in action 😍

@bakman2
Copy link

bakman2 commented Oct 27, 2019

I'd like to make a plugin for some lighting-specific utilities and UI components for working with kelvin scale colors, since no other javascript color pickers seem to be targeting that.

Would a brightness slider fit in there as well ? And to top it off - a slider without a wheel (as some lights only support brightness and no color). Or is that like the last example on the mockup ? Would be nice.

@jaames
Copy link
Owner Author

jaames commented Oct 28, 2019

@bakman2 Removing components (and adding extra ones) can already be done with Custom Layouts, although granted, redoing this documentation is on the to-do list since it's not particularly obvious right now :)

I'm unsure if a brightness slider (referring to the intensity of a light source rather than the color of it?) is really within iro.js' area of expertise, I'd prefer for it to focus on manipulating and choosing a color and let devs build extra controls around it if they need anything else.

@bakman2
Copy link

bakman2 commented Oct 28, 2019

Thanks for your response

I'm unsure if a brightness slider (referring to the intensity of a light source rather than the color of it?) is really within iro.js' area of expertise, I'd prefer for it to focus on manipulating and choosing a color and let devs build extra controls around it if they need anything else.

I am referring to the L/V in HSL/V, but I guess that is already covered

Do you perhaps have a little hint how I can use this library in vue ? When I include it in my main index.html, somehow I cannot initialize a new picker (using the mount option referred somewhere else in the issues, and using the vue mount() method) - sorry it is offtopic

@jaames
Copy link
Owner Author

jaames commented Oct 28, 2019

@bakman2 for now there's a wrapper; https://github.com/irojs/vue-iro-color-picker. This was written by a third party and I'm yet to do any work on it myself, so I can't guarantee that it's totally complete, but it might be useful to reference at least.

In the next week or so I intend to write React and Vue implementations of iro.js as part of the 5.0 milestone.

@jaames
Copy link
Owner Author

jaames commented Oct 29, 2019

Speaking of which, it's probably time for a progress report!

iro.js 5.0 is mostly complete and on feature-lock, the current changelog looks something like this:

Additions

  • New value/saturation box component
  • Optional vertical sliders (with new layoutDirection color picker option)
  • Optional circular sliders (with new sliderShape option when used with custom layouts)
  • New slider type for kelvin temperatures
  • Transparency slider is now built-in (iro-transparency-plugin will be deprecated)
  • New iro.Color static methods:
    • kelvinToRgb
    • rgbToKelvin
  • New iro.Color properties:
    • hue
    • saturation
    • value
    • alpha
    • kelvin
    • hsva
    • rgba
    • hsla
    • rgbaString
    • hslaString
    • hex8String
  • Misc:
    • Core iro.js functionality has been split off into a new iro-core package, which can be reused in other implementations for React, Vue, etc
    • New color picker updateOptions method can be used to update options at any time
    • Color picker layout can now be changed at any time

Breaking changes

  • sliderHeight option renamed to sliderSize
  • handleOrigin option renamed to handleProps
  • iro.Color.onChange no longer external
  • color:init event no longer provides color changes

Bundle size

  • I'm expecting the new min+gzip bundle size to be about 9.3kB, an increase of only about 2kB from the current version! I think that's quite impressive considering the huge amount of new features

From this point I'm going to focus on code cleanup and new documentation so I can get a 5.0 beta out, after that I plan to work on the React and Vue components and the new landing page.

The first beta should be ready to try in a couple of days, and hopefully 5.0 will be complete in the next week or two depending on how my schedule goes -- I'm also currently working on applying to a job at the same time so I might get a little busy :)

@jaames
Copy link
Owner Author

jaames commented Oct 30, 2019

A 5.0.0 beta is now available if anybody would like to try it! This is a beta so obviously I don't recommend using it in production, and documentation is still in progress.

From NPM:

$ npm install @jaames/iro@beta

Manual download:

https://raw.githubusercontent.com/jaames/iro.js/v5-dev/dist/iro.min.js

@jaames
Copy link
Owner Author

jaames commented Nov 17, 2019

Hey, sorry for the lack of progress. TBH I've been really struggling with burnout recently and I'm finding it difficult to find motivation to keep going with this project. The job hunt I mentioned also hasn't been going very well -- I live in a very tech-illiterate area and moving isn't possible, so there aren't a lot of options to begin with, and those who are hiring don't seem to be interested in anybody under the age of 30. Overall I feel like I'm stuck in a bit of a rut ¯\_(ツ)_/¯

I'm not, like, starving or anything, so please don't feel obligated, but I would greatly appreciate it if people would consider donating to help support my work on this. I still think open-source is cool but throwing endless hours into something just so that other people can make ungodly amounts of money from your work while you literally get nothing in return... kinda honestly sucks

Thanks :)

@RobbieTheWagner
Copy link
Contributor

@jaames I would be happy to sponsor some work on selecting multiple colors in a single color wheel. I'm trying to replicate the functionality of something like https://color.adobe.com/

I don't have a ton of extra cash, but definitely interested in helping further this along 😃

@jaames
Copy link
Owner Author

jaames commented Dec 19, 2019

Sorry for the slow response @rwwagner90, I really appreciate the offer!

Multiple colors should be totally possible, although in order to fit in with other features of iro.js I might have to depart from the way Adobe Color does things a tiny bit.

Can I ask how closely you're hoping to replicate the functionality of Adobe Color? Are you just looking to have multiple colors on one picker or do you also need color harmonies etc?

@RobbieTheWagner
Copy link
Contributor

@jaames I am implementing the harmonies myself, I would just need the color wheel to accept multiple values and I would supply the values.

@jaames
Copy link
Owner Author

jaames commented Dec 19, 2019

@rwwagner90 Alright, that shouldn't be too complicated then! I'm going to be a little busy until the new year, but I'll start working on multicolor and wrap up iro 5.0 as soon as I can after that :)

@RobbieTheWagner
Copy link
Contributor

@jaames what's the best way to donate to the cause?

@jaames
Copy link
Owner Author

jaames commented Dec 20, 2019

@rwwagner90 I usually take donations for iro.js via PayPal if that works for you, otherwise I could try getting set up with GitHub Sponsors or something

@RobbieTheWagner
Copy link
Contributor

@jaames GitHub sponsors should have matching I think, unless that is over now. Maybe try setting it up?

@DanielPeinhopf
Copy link

LEDs are very different in its behavior so this should be handled as close as possible to the hardware. So i think your LED controller should handle this.
This is also known as gamma correction.

@jaames
Copy link
Owner Author

jaames commented Jan 11, 2020

@rwwagner90 I put together a beta build with multicolor support! Everything works as detailed in the feature proposal, except colorPicker.color is always mapped to the currently active color. It needs a little bit more polish, but it should work well enough for testing. Let me know if you need anything!

From NPM:

$ npm install @jaames/iro@beta

Manual download:

https://raw.githubusercontent.com/jaames/iro.js/v5-dev/dist/iro.min.js


I have to focus on freelance work next week, but after that I'll get everything polished for release and return to work on writing v5 documentation and updating the iro.js.org website. :)

@RobbieTheWagner
Copy link
Contributor

Awesome, thanks @jaames! I will play with the beta in the next day or two.

@RobbieTheWagner
Copy link
Contributor

@jaames is there a way to set the selected colors programmatically? I'm able to get it to render with the list of colors, but then I do not know how to overwrite the list with a new set of colors.

@jaames
Copy link
Owner Author

jaames commented Jan 12, 2020

@rwwagner90 Yep! Once the color picker is set up you can access the selected colors with colorPicker.colors, which will be an array of color objects. Each of those color objects has several different properties that you can get and set, like with colorPicker.color (docs: https://iro.js.org/guide.html#selected-color-api). When any of these are set to a new value, the color picker will automatically update to match.

Here's some example code to make it a bit clearer:

// Create a color picker with multiple colors
const colorPicker = new iro.ColorPicker({
  ...
  colors: [
    'rgb(255, 0, 0)',
    'rgb(0, 255, 0)',
    'rgb(0, 0, 255)',
  ]
});

// Log the first color value as hsl
console.log(colorPicker.colors[0].hsl) // logs {h: 0, s: 100, l: 50}

// Set the first color to green
colorPicker.colors[0].rgbString = 'rgb(0, 255, 0)';

// Set the second color to white
colorPicker.colors[1].hsv = { h: 0, s: 100, v: 100 };

// Copy the hsv value of the second color to the third color
colorPicker.colors[2].hsv = colorPicker.colors[1].hsv;

Also, while they're not documented yet, there's lots of new iro.Color properties in v5 if you'd like to give them a whirl! They're listed here under "New iro.Color properties": #83 (comment)

@RobbieTheWagner
Copy link
Contributor

RobbieTheWagner commented Jan 12, 2020

@jaames I need a way to change the entire array of colors, insert and remove colors etc. I'm thinking like

colorPicker.addColor('#ffffff');

colorPicker.removeColor('#ffffff');

colorPicker.setColors([
    'rgb(255, 0, 0)',
    'rgb(0, 255, 0)',
    'rgb(0, 0, 255)',
  ]);

The use case is for selecting a color palette and changing out all the colors to match the palette. An alternative would be to create a new iro instance each time, but I wasn't sure the correct way to destroy the existing one before creating a new one.

@jaames
Copy link
Owner Author

jaames commented Jan 12, 2020

@rwwagner90 colorPicker.addColor() and colorPicker.removeColor() are implemented, although removeColor() expects the color's index to be passed as an argument rather than the color's value.

I'll look at adding something like setColors() when I get the chance, but here's what a basic implementation that matches your suggestion would look like:

iro.ColorPicker.prototype.setColors = function(newColorValues) {
  // Unbind color events
  this.colors.forEach(color => color.unbind());
  // Destroy old colors
  this.colors = [];
  // Add new colors
  newColorValues.forEach(colorValue => this.addColor(colorValue));
  // Reset active color
  this.setActiveColor(0);
}

@DanielPeinhopf
Copy link

The new multi color picker is great 👍
Many many thanks.
Would it be possible to add an option to display index numbers around the thumbs?
And another great thing would be to add new thumbs by clicking somewhere inside the wheel, instead of moving the thumb which has been selected last.

@RobbieTheWagner
Copy link
Contributor

@jaames ah, thanks! I did not see addColor or removeColor in the docs. Are they new for 5.0?

@jaames
Copy link
Owner Author

jaames commented Jan 12, 2020

@rwwagner90 no problem! yeah, theyre new, they were added as part of the multicolor proposal above :)

@DanielPeinhopf I like those ideas! I think I'll save them for a future version though, I really need to focus on updating documentation for now

@RobbieTheWagner
Copy link
Contributor

@jaames how are things going?

@RobbieTheWagner
Copy link
Contributor

I need a way to know which handle is associated with which color, so I can "select" the handle and style it differently, move it above all other handles, etc. Is this something that is currently supported? Like how on color.adobe.com when you click other colors it moves the handle above all the other handles.

@jaames
Copy link
Owner Author

jaames commented Feb 9, 2020

@rwwagner90 Things are going alright! I'm still working away on updating the documentation website, progress has been a little slow since I've also been busy with freelance work and applying to a job, but it is very nearly done now. I just need to give it a bit more polish and write some examples to demonstrate new features.

At the moment the handle for the currently active color should always be drawn on top of the others. SVG doesn't really support anything like CSS' z-index, so the 'top' handle is always last. As such, it's possible to target the 'active' color's handle with a CSS selector like .IroColorPicker .IroHandle:last-of-type, but it's not possible to target any handle by its associated color.

I'll look into making it a bit easier to target specific handles after the docs are done :)

@RobbieTheWagner
Copy link
Contributor

@jaames sounds good! Docs in general are definitely more important.

At the moment the handle for the currently active color should always be drawn on top of the others. SVG doesn't really support anything like CSS' z-index, so the 'top' handle is always last. As such, it's possible to target the 'active' color's handle with a CSS selector like .IroColorPicker .IroHandle:last-of-type, but it's not possible to target any handle by its associated color.

Sounds like we may need a function like makeActiveColor where we could set which color / handle are active and move that svg to last in the list, so it is on top.

@jaames
Copy link
Owner Author

jaames commented Feb 9, 2020

@rwwagner90 There's a setActiveColor method that should do the trick!

Obviously the multicolor stuff isn't publicly documented yet (...heh), but here's the relevant part of the source if you want to see what's available:

iro.js/src/ColorPicker.tsx

Lines 79 to 113 in e66e0ee

// Plubic multicolor API
public addColor(color: IroColorValue, index: number = this.colors.length) {
// Create a new iro.Color
// Also bind it to onColorChange, so whenever the color changes it updates the color picker
const newColor = new IroColor(color, this.onColorChange.bind(this));
// Insert color @ the given index
this.colors.splice(index, 0, newColor);
// Reindex colors
for (let i = 0; i < this.colors.length; i++) this.colors[i].index = i;
// Update picker state if necessary
if (this.state) this.setState({ colors: this.colors });
// Fire color init event
this.deferredEmit('color:init', newColor);
}
public removeColor(index: number) {
const color = this.colors.splice(index, 1)[0];
// Destroy the color object -- this unbinds it from the color picker
color.unbind();
// Reindex colors
for (let i = 0; i < this.colors.length; i++) this.colors[i].index = i;
// TODO: what happens if removed color is active?
// Update picker state if necessary
if (this.state) this.setState({ colors: this.colors });
// Fire color remove event
this.emit('color:remove', color);
}
public setActiveColor(index: number) {
this.color = this.colors[index];
if (this.state) this.setState({ color: this.color });
// Fire color switch event
this.emit('color:setActive', this.color);
}

@RobbieTheWagner
Copy link
Contributor

@jaames setActiveColor doesn't seem to change the color selected. Are you sure it is working as intended?

@jaames
Copy link
Owner Author

jaames commented Feb 10, 2020

@rwwagner90 It's the same method called internally when you interact with one of the UI handles, so as long as the last handle you interacted with is shown on top of all the others, it should definitely be working correctly. setActiveColor expects to be passed the color index rather than the color value though, maybe that's catching you out?

In lieu of documentation I put together a quick Codepen demo, hopefully that will help make things a bit clearer :) https://codepen.io/rakujira/pen/bGddRyq?editors=0010

@RobbieTheWagner
Copy link
Contributor

RobbieTheWagner commented Feb 10, 2020

@jaames I was passing the index. It still doesn't seem to work for me. However, I do not have a reference to the actual color index, I was just setting to the index it was from the order of colors I had. If I set all the colors a few times, does the index keep growing? I wonder if with several palettes, my indices are like 15, even though I only have 4-5 colors.

I suppose I should find a way to store the index somehow to be sure.

@jaames
Copy link
Owner Author

jaames commented Feb 10, 2020

@rwwagner90 Ah, my bad. The color index shouldn't keep growing, assuming that you're using the setColors() method I posted whenever you switch the color palette? Are you setting the palette as a series of color values (like hex strings or whatever) or are you using the iro.Color objects that iro.js provides?

I'll take a deeper look tomorrow since it's getting late here, but sounds like there might be a bug on my end somewhere if that doesn't work as expected.

@RobbieTheWagner
Copy link
Contributor

@jaames I'm doing this this.colorPicker.setColors(this.selectedPalette.colors.mapBy('hex')); so I am setting colors as hex. Should I be doing something else?

@jaames
Copy link
Owner Author

jaames commented Feb 11, 2020

@rwwagner90 That looks correct to me.

I made a basic multi-palette demo on Codepen to test, and everything seems to be working okay as far as I can tell. Not sure if there was something I missed? The only change I made was having setColors fire its own event so I could re-render the color swatch HTML whenever the selected palette is switched.

https://codepen.io/rakujira/pen/poJJYVP?editors=0010

I should maybe mention that only the active color handle is guaranteed to be drawn on top of the other ones. The other handles will be drawn in the same order that they're provided to the color picker with.

@RobbieTheWagner
Copy link
Contributor

@jaames when I call setActiveColor nothing happens at all for me. The handle does not move, and the slider does not switch to the new color. I'll try to debug more later today. Should I be creating iro color objects instead of using hex values?

@jaames
Copy link
Owner Author

jaames commented Feb 11, 2020

@rwwagner90 That's really strange. Just to rule out any potential browser differences, does that last Codepen work for you? It shouldn't matter whether you use color objects or hex values, etc -- setColors() will work with either.

I'm not extremely familiar with Ember, but is there a chance that it's doing something that affects the color picker in some way? If you don't manage to get to the bottom of it, I think a reproduction repo would be helpful.

@RobbieTheWagner
Copy link
Contributor

RobbieTheWagner commented Feb 11, 2020

@jaames yeah, the codepen works for me. I will debug more later and report back. To confirm, this should work in 5.0.0-5 right?

@jaames
Copy link
Owner Author

jaames commented Feb 11, 2020

@rwwagner90 Yeah, 5.0.0-5 is the right version.

@RobbieTheWagner
Copy link
Contributor

@jaames I got it to work. I was doing something dumb. Sorry about that!

I was just looking at the image above of the new stuff like the square picker, additional slider types, etc and I was curious if that stuff had also been implemented? I would love to try some of it out 😃

@jaames
Copy link
Owner Author

jaames commented Feb 23, 2020

@rwwagner90 Hah, no worries!

Yep, those are implemented now! The documentation can be found here: https://iro.js.org/advanced.html#custom-ui-layouts

@jaames
Copy link
Owner Author

jaames commented Feb 24, 2020

Also, I finally published iro.js v5 and the new documentation site! I'm going to continue working on things over the course of the next week or two, so there's still some pending changes on the docsite and little bits like the readme that I need to finish. :)

But without further ado, here's the full v5 changelog! 🎉

  • Rewritten entire library in Typescript (thanks KaanMol and mksglu for getting me started!)
  • Split color and generic UI coordinate logic into a separate package (iro-core), in preparation for creating dedicated React and Vue packages on top of the same core logic
  • Added support for kelvin temperatures (with color.kelvin, iro.Color.rgbToKelvin() and iro.Color.kelvinToRgb()).
  • Added transparency support without the need for a separate plugin
  • Added some shorthand color properties for common color channels (red, green, blue, hue, saturation, value, alpha)
  • Added new color properties for color-with-alpha formats (rgba, hslaString, hex8String, etc.)
  • New API for handling multiple selectable colors on the same color picker:
    • Added color objects index property, for keeping track of their position in the color array
    • Color pickers now have a colors property which provides an array of its selectable colors
    • Color pickers now have addColor, removeColor, setActiveColor and setColors methods for manipulating the color array
    • Added color:setActive and color:remove and color:setAll events
  • UI additions:
    • Customisable layout direction with the new layoutDirection property (thanks asonix!)
    • New saturation-value box component
    • New slider types for kelvin temperatures and transparency
    • New circular slider shape
    • Improved touch input handling
  • Breaking changes:
    • Removed plugin API
    • sliderHeight option renamed to sliderSize
    • handleOrigin option renamed to handleProps
    • iro.Color.onChange no longer external
    • color:init event no longer provides color changes
  • Added color picker setOptions method to update config options at any point
  • Added color picker reset method to reset all colors back to their initial values
  • Redesigned the project website so that it does a better job of showing off what the library can do 😎

Additionally, there's some smaller features that I'm hoping to add next week:

  • A way to responsively resize color pickers
  • Some presets/shorthands for the layout config option
  • Bringing back the transparency option from the transparency plugin, to quickly add a transparency slider to the color picker

I'm sorry that it's taken me so long to finish all of this - it's been a pretty big undertaking! I also owe a huge thanks to @rwwagner90 from Ship Shape for sponsoring the project, it's really helped out a lot :)


I'm going to close this thread now, but please feel free to continue the conversation! You can also reach me via email, Twitter or Discord (jaames#9860)

@jaames jaames closed this as completed Feb 24, 2020
@RobbieTheWagner
Copy link
Contributor

Thanks so much for all the hard work @jaames! We'll hopefully be announcing our product using your library soon 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants