[krita] /: Merge in new internal color picker dialog!

Wolthera van Hovell tot Westerflier griffinvalley at gmail.com
Tue Sep 6 14:19:43 UTC 2016


Git commit 93ef7c8ef97e3ba5a1349ba38408269205a9d2b8 by Wolthera van Hovell tot Westerflier.
Committed on 06/09/2016 at 14:17.
Pushed by woltherav into branch 'master'.

Merge in new internal color picker dialog!

Tremble, dear commit reader, for a new era of color picking has arrived!

This is the second part of my Google Summer of Code 206 project. It is a internal color selector, that can handle wide-gamut colors, pick colors from the screen (which is smart enough to identify Krita canvases and pick the correct color managed color that way). It also changes properly using the lut manager exposure controls, and it’s main element, the visual color selector can use the advanced color selector config.

This selector is also intergrated into a kis_color_button and used where ever I could port it reliably. It’ll also show up in the pop-up palette.

Furthermore, this merge contains little palette usability things, like being able to see the swatch name, search by swatch name and have the split->layer functionality use a palette to name the resultant layers. Also allows custom-pattern to be mindful of the active selection.

Anyway, needs a lot of testing!

CCMAIL:kimageshop at kde.org
Ref T2337
Ref T2438

Squashed commit of the following:

commit 1cf8527877d316b0c3149494535740b7ff3e5c6f
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Sep 6 16:16:24 2016 +0200

    Fix build

commit d39cecc36ab9fa2f32de8fa3cefe7072c1824dcf
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Sep 6 15:32:08 2016 +0200

    Rename the internal color selector dialog to reflect it being a dialog

commit afc8658b4114df00644061105b4ed56f08cc257b
Merge: 27d4034 91bdcfe
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Sep 6 15:22:33 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 27d4034efe5d37cde00bb3dd33cab985f6deacd2
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Sep 3 16:35:23 2016 +0200

    Fix screencolor picker label.

    Ref T2438

commit 29d34d885455f1e5fbfd3ba0e1c5c92974d4f2bf
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Sep 3 16:20:07 2016 +0200

    Fix color conversion issues with the selector.

    Now the selector will show grayscale on a mask, and will update upon changing the image color space.

    Ref T2438

commit 3dc397583dbb93b4a362abce1ad6df50ee2c7485
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Sep 2 17:47:53 2016 +0200

    Simplify Gradient Map filter and make it usable as a filter layer.

    There's some awkwardness with the first two generic gradients as the color isn't stored, but this is good for now.

    Fixes T1837

commit 4a4f704e1700a24f214a844879df09128df64b95
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 17:34:00 2016 +0200

    Fix drawing the gradient

commit 13f83919be65000fc1682940afe6c81fdcc8c1ae
Author: Julian Thijssen <Nimthora at gmail.com>
Date:   Fri Sep 2 17:30:51 2016 +0200

    Nearest neighbour filtering applies on all zoom levels

commit 0a4a62bc9370878441d57f87ed50fbbc7d394ef7
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 16:36:02 2016 +0200

    Refactor KisColorSource to use KoColor in a saner way

commit 58bf4b9ab601c6f5f0aa593c5e86c20ee994e545
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 16:21:40 2016 +0200

    Make KoSegmentGradient::colorAt threadsafe

commit 54df09f834a5fa36db6b98742f7ac05ec9b90170
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 16:21:19 2016 +0200

    Make this class safe

    It means we don't cache the QImage, but there is no alternative

commit 362c78b89d997845e0fdd7764dd896d031ac632c
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 16:21:02 2016 +0200

    Warn that this class is not threadsafe

commit cd02553f552f01cd73c2ec57874195f82d4110f3
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 16:06:51 2016 +0200

    Make KoStopGradient::colorAt threadsave

    Sneakily, the "buffer" variable was made a class variable. Marking
    it mutable allows us to change it from a const function, which hides
    the fact that this is global data (doubly hidden by there not being
    an m_ prefix), which makes the const function thread unsafe.

commit 904cc82dbdc387e93a478a4a661b7122ce8b965e
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 15:56:24 2016 +0200

    Also revert the patch

commit 349b5e776205e844268835f603f36bf89c8eb7b3
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 14:57:27 2016 +0200

    Try harder to find the tag files on Windows and OSX

    This is yet another KoResourcePaths problem...
    BUG:366757

commit dbaa7bcdcdaf3ce139227988dca4ba2e6a85f191
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 13:56:14 2016 +0200

    Fix logic error...

    I shouldn't code during a sprint, only afterwards

commit 71692523af5cd589e3b5059b8960a00b446c8e20
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 12:09:42 2016 +0200

    Fix typo

commit 88bf822c445752d10ea962e88b8e31c8ad8cf337
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 11:56:59 2016 +0200

    Go back to ki18n 5.17 for now

    To avoid the system-language bug until it's fixed.
    CCBUG:368007

commit 6f057f4659283fb847f4a74f6781541e4cf91672
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 11:35:54 2016 +0200

    Remove unused ui file

    (Was forgotten in

    commit 010c0f3066d872d0f91ec3a38057b4fcaedca4ad
    Author: Boudewijn Rempt <boud at valdyas.org>
    Date:   Sat Mar 30 12:22:40 2013 +0100

        Remove unimplemented custom palette dialog
    )

commit 4e053745797b9a70ef98555465f6dadb40eed117
Author: Eugene Ingerman <geneing at gmail.com>
Date:   Tue Aug 30 22:14:51 2016 -0700

    Fixing https://bugs.kde.org/show_bug.cgi?id=367901. Removing wait which
    causes possible race condition.

commit 99b11b2bfa6a5b3af93c83de5877e4b1edbe07ee
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Fri Sep 2 14:30:20 2016 +0200

    Improve the view selection when color picking

    We can easily grab a list of all existing views and check whether
    they are under the cursor. Color picking from a krita image now
    gets the color directly no matter the active window or view.

commit 16c8832c93424f208ad54735777bdf2756c92161
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Sep 2 12:18:36 2016 +0200

    Port the last areas to use the KisColorButton as far as possible.

    There's still the grid docker, which has a bit of a UI problem, and then rest is flake and friends.

    Ref T2438

commit ef9aeb29492afed382ee8e153c6290867e42b6d3
Merge: ceaafb0 58364da
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Sep 1 22:04:37 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit ceaafb000d1ee9da7078bb589f418b59218f6948
Merge: f70701d 853e42f
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Sep 1 13:30:58 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit f70701dced469bdcd82aaadcc868d3bb06507465
Merge: ed64943 fe21cb5
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 31 22:37:24 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit ed649432567924e02ddb7c0ac45f259f0eab4b3a
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 31 22:32:02 2016 +0200

    Add the kiscolorbutton in more places

commit d635b53e2586af1e811d00c2f4b7110694ec21a6
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Mon Aug 29 11:52:25 2016 +0200

    Make the UI layout of the internal color selector a little nicer.

    Ref T2438

commit cf7c567a9194d999fa1c2dd90a20d9353ba61ee3
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sun Aug 28 15:08:03 2016 +0200

    Fix issue with gamut alarm default space

commit 364d1b3cc873cc3fa5662299405de10f390fb12e
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sun Aug 28 15:02:21 2016 +0200

    Use sRGB for the UI

commit 23dcf5d9d0f3ff2b25b7e86d826d48be37b322e2
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sun Aug 28 14:54:46 2016 +0200

    Replace kcolorbutton with new kiscolorbutton in several places.

    The new dialog is accesible from all these places.

    There's still several places where they still need to be replaced.

    Ref T2438

commit c5621355279c211721a74e2d4affa0d322e3de9f
Author: Sven Langkamp <sven.langkamp at gmail.com>
Date:   Sat Aug 27 10:50:40 2016 +0200

    Pick color from canvas directly if the cursor is over the canvas

commit 1afa4384e84fa5af6f8681545787f81cdd4f183e
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Aug 26 18:29:19 2016 +0200

    Use internal visual selector in the Pop-up palette.

    This means you finally can have your shape of choice inside the pop-up palette!

    Needs testing, obviously.

    Ref T2438

commit 9a07179d79d8ed3333cd772c002a98e27df03138
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Aug 26 16:10:31 2016 +0200

    Fix updating in modal dialog.

    Also add an extra check for 8bit so we can be a bit more precise in 16bit and higher.

    Ref T2438

commit cdd0cd6a54876dbba5c102160e4bf523fec64b39
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Aug 26 15:15:24 2016 +0200

    Fix offset for circular shape.

commit 97372d6eef81bd2623e5575013045f73d5f95ed0
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Aug 25 11:43:14 2016 +0200

    Make the custom pattern widget take the selection into account.

    Now, if you have a selection, it'll use only that area to retreive the pattern from.

    I was thinking of whether it needed an extra toggle, but both Scott and Boud thought it was implicit that having a selection means you want to use it.

    This is my first time playing with selection code, so a glance would be nice.

    Auditors: dkazakov

commit de26f01fcd4544bffc11947b64e08418666135f2
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 19:20:13 2016 +0200

    Check for colorspaces with or not and, a cs can't be all at the same time.

    This fixes floating point from the visual selector shape again. :)

    Ref T2438

commit 80a8d54ed249a6c65a46db5181a17606a579b693
Merge: 389c2bd da04c19
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 16:22:56 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 389c2bd5123af74918bc26949823dcb75867bafb
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 16:21:23 2016 +0200

    Fork KColorButton, make it use internal selector dialog.

    For now only in the fill layers.

    Ref T2438

commit c71c0b696915258aae3adad4345005fadb3e561a
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 14:37:50 2016 +0200

    Add config struct to kisinternalcolorselector

    Ref T2438

commit 439cc77b25571338dfc0c23cf3f09023cdd9d344
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 13:54:36 2016 +0200

    Add offset to circle and rectangle as well.

    And more cursor fixes... grrrr.

commit fcdc7cd1d153942dde834c5532dfd5816132cd75
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 12:43:06 2016 +0200

    Fix errors in HSL formula.

    Also fix hsx cursor wiggling position _again_...

commit ba6dd494ee239ad65d5306aca8c46abee7f04bea
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 11:18:01 2016 +0200

    Fix loading on config change.

commit 28505a7455211f9448abb880af83b078b3e8fd2c
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 10:33:52 2016 +0200

    Fix HSX cursor position on 0 sat, AGAIN.

    This is the best I can give it.

commit 68739e5dc010f830667b3a949963a91656651dd3
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 08:57:09 2016 +0200

    Use Advanced Color Selector Configuration to set visual's shape, p.2

    The debugging.

    Probably not all bugs, but the obvious ones are gone now.

commit e7d52d68b75edfd09200926567536fec25e9a4e8
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 08:05:58 2016 +0200

    Use Advanced Color Selector Configuration to set visual's shape, P3

    P2 came before p2. Anyway, this implements resizing. Now left-over debugging.

commit 6995071af937c32fcb92d8b0c20e42135d427a51
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 24 00:12:25 2016 +0200

    Use Advanced Color Selector Configuration to set visual's shape, P1

    Now only need p2: the debugging, and p3: the resizening...

    But happy this is out of the way.

    Ref T2438

commit 763a373b26cc1d2a3ab57e8982ede68ca727bb32
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 23 22:15:09 2016 +0200

    Add Hex code widget that only outputs and reads sRGB colors.

    Nothing else understands having hexcode in other spaces anyway.

    Ref T2438

commit 04707daf21d4201684dc8860151678a276331d76
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Tue Aug 23 18:55:04 2016 +0200

    Move KisColorInput to libs/ui/widgets

commit fbc74f15121590b10144da71a777709f1c75fab5
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 23 16:11:21 2016 +0200

    Add colorspace locking to the internal selector.

    So it doesn't flip between colorspaces all the time.

    Also fixes a crash in KoDualColorButton

    Ref T2438

commit c33f2ae2939130d8a05b5e6596d07eba95bf87b7
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 23 15:02:47 2016 +0200

    Remove qstring compare in commonly called function.

    Should speed things up.

commit 12799acad033e3825399af81341dcc78f531907e
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 23 14:44:46 2016 +0200

    Make mouse press event select a color too.

    Also speed up the timers a little bit.

commit b97cef85d33eb71fc8ef4057d4c04bdf95edb986
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 23 13:58:11 2016 +0200

    Allow the modal dialog to have ok/cancel buttons as well.

    According to boud, some desktop enviroments have no close button on dialogs.

    Ref T2438

commit 960bde483a5f66918bfb5507b7e15559d5d9cb6e
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 23 13:56:55 2016 +0200

    Make color selector faster.

    By removing a mask check.

    Ref T2438

commit e06052e2509701fbe31a1e80fa89dd6237ec8ad0
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 23 10:52:40 2016 +0200

    Turn on tagging for palettes.

    This was a matter of toggling an option. Beware that tagging with palettes will have all the bugs associated with the other tagging options.

    With the colorname hover-options, this means that this fixes
    BUG:360453

commit 82d1a1b795f9897e6fb9e86dd21a26eac1cf9814
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 23 10:40:41 2016 +0200

    Make the color names drop down update when you choose a color on the palette itself.

    Seemed like it should to me.

commit e0ed2fd7586e068121e22cbea31a4b7d82379c99
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 23 10:29:40 2016 +0200

    Add the ability to let the layer split use color names from a palette.

    This also implements two 'closest match' functions in kocolorset. One for the name, the other only for the index.

    BUG:348837

commit 73eb12ee2571759c86c8a55c135ec4ecd769e396
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Mon Aug 22 16:52:10 2016 +0200

    Add a little combobox that allows you to search the palette colornames

    If I was better with regexp it might've been a bit smoother, but at the least you can now type in a colorname to select it quickly.

    Ref T2438

commit 68c2c8ed8ca8c6c1d820ed4a6888206a43b58fc1
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sun Aug 21 14:29:24 2016 +0200

    Add some offset to the triangle selector.

    Also fix some issues with setting hsv and fix and remove some debug.

commit 6d3b11f6746652844616b0a52a7e86b5441181b2
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sun Aug 21 11:46:46 2016 +0200

    Make column-count work with colorset widget.

    Now the palette swatches align :)

    Ref 2438

commit bc1ad37b974507b203ec64e9e98d30385e2e6d29
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 23:30:51 2016 +0200

    Add using the colornames in the approprite colorset widgets.

    The palette docker doesn't have the ability to give tooltips due being a slightly different model, so hence the extra label.

    I also tried setting the kocolorsetwidget the size of the current column count, but this crashes on startup for reasons I cannot understand.

commit 22ccd6620964769274e13ea5778b9e7dfe29e1fc
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 21:42:32 2016 +0200

    Make prettier and change previous color focus event.

    Ref 2438

commit 8c2914254e053f314b803b4f064c5534a7aeb4ba
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 19:24:35 2016 +0200

    change kodualcolorbutton about to simply code.

    This doesn't prevent a crash when closing all available documents, sadly.

commit eb1232be68bae9d71130d4c3a56f4f139b89c4ba
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 18:22:49 2016 +0200

    Fix channel-order, hue rortaton and the mirrored circle border

commit 0718fb65ab9fb4d9168e2ca76bb2600a754ebb1e
Merge: 541b596 bba9f1c
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 16:49:09 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 541b596e74547fcbd8e14857e08685e88e9450cd
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 16:47:42 2016 +0200

    Make drawing the image slightly faster.

    But it's not fast enough yet. Also using QImage everywhere now, it's a bit more sensible...

    Ref T2438

commit b440e55a6094128fb6f3a1da0f41045ee4a4edc9
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 14:42:56 2016 +0200

    Fix a bunch of minor issues.

commit 6655f984354de967f9217787e8e6a3eda3b5bb74
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 14:28:44 2016 +0200

    Add display color converters to the KoColorSetWidget/KoColorPatch

    Ref T2438

commit b5a0d6c36c15f0e9d1d5ba821f623df151122a8a
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 13:30:35 2016 +0200

    Fix selector on single-dimension hue wheel, also rotate hue.

    Ref T2438

commit f8fb2e088596ff430db5d4a74fd18f4fbbd58f82
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 20 12:34:19 2016 +0200

    Add cursor position to the triangle.

    I spent 9+ hours trying to figure out how to make one where the value length fully vertical, but failed, so gave up and copied the kis_color_selector_triangle solution.

    Ref 2438

commit 36e4b72ceca1f6d7c72372b218decb463cdfd4df
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Aug 19 12:18:40 2016 +0200

    Attempt to fix flickering... this doesn't fix it :/

    Makes the code simpler though...

commit 0442f67e2c9435705ccc5a994af6a9984a0a496d
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Aug 19 12:05:55 2016 +0200

    Add anti-aliasing to the shapes.

    The jaggies were starting to annoy me.

    Might make the pixmap into a image later just so we can have proper transparency.

commit 8aef9fe603f284572b1c67ca0b5153bf92067023
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Aug 19 11:23:55 2016 +0200

    Fix clamping again.

    The previous code made not much sense...

commit 8737642881dc971e9b1469cae7dd5f9f283787fe
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Aug 19 00:00:28 2016 +0200

    Add triangle and elliptical visual selectors and set default to ring+triangle

    This is a bit finicky still. Also weird bugs with Qt cause flickering when changing widgets, due to having to force them to show. :/ Might need to think a bit longer about this...

    Ref T2438

commit fd5f3a2d716b43a4940868f24ea549224391a172
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Aug 18 12:38:08 2016 +0200

    Add mirrored border.

    This is useful for non-cyclic channels.

commit d7a4e7e9175c18de53d89d834ca544f26500517d
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Aug 18 02:19:10 2016 +0200

    Implement rectangle border

    Not too useful and actually a little slow, but good practice.

commit 20febd119bea269cca7c58efa6c05f592eee4fcd
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 17 21:54:38 2016 +0200

    Add KoColorSetWidget, and KoColorPatches for current/previous color

    Also rearranged the widget a lot. The KoColorSetWidget is automatically filled with the first palette in the list(which is, as always, concept cookie), and the palette is saved... right now on leave and accept events, which might not be the most intuitive, but at the least it is saved and loaded correctly.

    Neither widget has the color management from the displayrenderer, as that would require me editing those directly.

    I would like an eye on said save/load code.
    Auditors: rempt

commit d9fc35c32ce0886fbeb43c85249af40b4c254b98
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 17 17:35:32 2016 +0200

    Add anti-cursor resetting measures, and add docs.

    The cursor won't flip about when desaturated, but saturation itself is
    still very tricky. Either way, outside updates won't affect a thing.

commit d09605cbaefe1d65b92ba843ae75eefc7f76daa0
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 17 16:07:17 2016 +0200

    Fix HSV mode

    Turns out there was an 'undefined' value...

    Ref T2438

commit 5282f861e57ed94d9224b993b5a81c1913f5fdc1
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 17 15:39:40 2016 +0200

    Do clamping in color space traits properly.

    Previous version just didn't work. This fixes the HSL output.

    Ref T2438

commit c6119f6d061b61afb0d8ff240e86bcc21ce5cf4d
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 17 15:30:50 2016 +0200

    Don't manage non-floating-point spaces

commit 589b5c645eb276104d2cf804a4ce6a82741be2b0
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 17 12:59:27 2016 +0200

    Fix display configuration updating.

    That's now fully working :)

    Ref T2438

commit 553efe20ac7ea8eb2f8865cc00779b9b2b736439
Merge: e4b42d2 ffc4d9c
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 16 20:52:03 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit e4b42d286eea279a22a26494de059ca8ab474ba1
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 16 20:48:32 2016 +0200

    Fix non-painting space deformation

    By disabling it... this looks a bit odd, might be changed.

    Ref T2337

commit 0246b4ba3d7d1948e5de80426ca707c2da583350
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 16 18:58:22 2016 +0200

    Enable High range color picking for the visual selector.

    It has huge issues when using a color space that isn't the displayrenderer's but I think that can be fixed.

    Ref T2337

commit 62a4f7c6aea23277d40acd5700ac28b3dada1174
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 16 18:57:35 2016 +0200

    Fix spinbox updating float.

    Again, could be prettier.

    Ref T2337

commit ae0fd531f89f9c2bd000de318de9d3bf05c0f3af
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 16 18:25:25 2016 +0200

    Enable typing hdr values into spinbox.

    This could probably be a little more elegant...

    Ref 2337

commit a5c0408ae52c26afcca6298ebf6188a04b2aafe9
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 16 17:30:01 2016 +0200

    Make the display color converter of the dualcolor button get updated.

    This enables the the display color converter on the internal color selector too.
    There are still update and range bugs, the range bugs being tricky and the update bugs being probably due wrong signal being connect, but I am pretty pleased with this.

    Ref T2337

commit ca0a03338f47890197c65d3f47d46c0b28327505
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 16 15:09:59 2016 +0200

    Add HSI and HSY support to the visual color selector.

    This was mostly an experiment, which was succesful in proving to me that
    the HSL and HSV functions have issues with non-chromatic values. HSY and HSI are more notably slow, so kept HSL as the RGB default.

    Ref T2337

commit b7a45b003986014da93a05d7f0b88fade41183ce
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 16 15:08:45 2016 +0200

    Clamp normalised values before pouring into pixel.

    This should prevent roll-overs, but it doesn't fix the bug I was initially trying to fix, which instead seems to be a bugged HSL function.

    Ref 2337

commit db436ad7efffe95790be93a182254331df03b197
Merge: 00b8d54 a819895
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Aug 16 12:22:54 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 00b8d54f9fafcb07b2571faff9b1bf0d533006ae
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Mon Aug 15 21:33:40 2016 +0200

    Attempt to further add displayconverter integration...

    I can't get much further here due the inability for kodualcolorbutton
    to have a display renderer, due MVC. Fun times...

    Ref T2337

commit 0eee33995a4c1535d5388007dc51d4586ccbe15f
Merge: 0c201bc d07cdb6
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Mon Aug 15 17:05:50 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 0c201bc0b79c2e328f79c26ac1b624990cfbc7a5
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Mon Aug 15 17:04:54 2016 +0200

    Initial implementation displayrenderer

    Will need to change it now...

commit 9c39f81cc1f21a23d33b5714fecd57f1c90f846e
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Mon Aug 15 15:25:22 2016 +0200

    Fix rounding-error wiggles.

    By not allowing the thing to update it self...

    Ref T2337

commit c52ca3f46c8bfd5d53385f84a17d1869e3ae403f
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Mon Aug 15 14:42:22 2016 +0200

    Make moving the cursor around more pleasant

    Ref T2337

commit 5f1619768e77354adfd60d54d63def27fce280da
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Mon Aug 15 13:23:00 2016 +0200

    Fix order of Hue, make single-dimension-cursors nicer.

    Ref 2337

commit 692d4d261de781aaf6901b984639eeedcc1ad967
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sun Aug 14 19:28:34 2016 +0200

    Fix order-error.

    Ref 2337

commit 9acd7f1558a323957cb336061e747da73c1a809c
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sun Aug 14 18:19:32 2016 +0200

    Fix HSL and HSV

    Of course, using HSL and HSV brings back our friend the 'wigglyness', so I'll need to do something about that in time.

    Ref T2337
    Ref T2438

commit 31931e3a522e4f58735b17b4547c4719b2cfe6d6
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sun Aug 14 17:38:32 2016 +0200

    Add visual selector shapes.

    These now work fully for the channels. They give nice squares.
    I made a base class that only deals with the events and the classes, and added a rectangular subclass. This way we can make our circles and wheels and whatever easily.

    Ref T2337
    Ref T2438

commit e3f78b79cd77c7e1b1fdaf0b59f1780cc9380628
Merge: 273dd04 ebc8a43
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 13 15:01:25 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 273dd04a1cd989c10642294d26b8a776df665bf0
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 13 14:57:12 2016 +0200

    Add screen color picking widget.

    This is a widget with a button that allows you to select anywhere on the screen. It's not smart enough yet to recognise Krita windows and canvases and to select the color managed value, but it is a nice self contained widget, which I find pretty impressive already.

    Ref T2337, T2838

commit ea086782934840da5fea9f58eb0cbd1572f3a327
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 10 23:41:49 2016 +0200

    Give spinboxes names, fix order spinboxes, do cleanup.

    Ref T2337 T2438

commit 37d1a1cc9f201213c77b896401ce022281c5d02e
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 10 16:46:57 2016 +0200

    Change spinboxes to numerical spinboxes.

    Ref T2337

commit 99feb3b812322c2d926d33a7437e6aab66723d93
Merge: 6f18c4c 92c253a
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 10 16:09:58 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 6f18c4c3272a8b5a7eb85febee6b304a18a99553
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Aug 10 16:05:58 2016 +0200

    Make internal color selector dialog possible to do modal mode.

    So right now, KoDualColorButton has Non-modal mode on the foreground color and modal mode on the background color.

    Also contains a lot of cleanup, the UI files for example now working
    properly.

    Ref T2337 T2438

commit fbdce997fd703106a33ea4918a39e0db42f9f983
Merge: 3839839 6530b6d
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 6 12:47:42 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 38398393973fb993ae0644ba777c5214ba63a2a0
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 6 12:42:37 2016 +0200

    Remove signal compressor, use block signals instead.

    This makes the updating of the spinboxes much easier. Might
    be using this method more commonly.

    Ref T2337, T2438

commit 55350f021cb559ffe823fa5a1d8d170684a494ba
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sat Aug 6 01:16:17 2016 +0200

    Move KoDualColorButton, attach internal color selector.

    It doesn't crash, it updates, gets updated, can select colors, wide gamut colors, changes configuration based
    on selected color's color space... It still needs to be cleaned up and have fluid updating. Also 90% of the rest of
    the selector, but I first want to get this updating slot signal mess clean.

    Can I keep using QObject::sender()? It's making my life very easy.

    Auditors: rempt
    Ref T2337, T2438

commit 6d336838602b0ad25ebb35ed17d118b6ed38f588
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jul 28 18:04:40 2016 +0200

    Add very simple 'colorselection' dialog with a widget containing spinboxes.

    Right now the spinbox widget is able to adapt itself to all colorspaces, and having it
    as a separate widget makes it into a nice building block for other uses too.

    I can't actually connect this to anything, because all our color buttons seem to be K and Ko,
    so that will be the big task tomorrow...

    Ref: T2337, T2438
    Auditors: rempt

commit 7ce94758d0e459a86fd2eb9f75066322a78e98aa
Merge: 38c4fc3 9ed50d1
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Jul 27 22:21:40 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 38c4fc32021af778b9446a05502c885087bc0ff2
Merge: 5477611 e308ed0
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Jun 28 17:46:16 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 54776118b78a3f32b408de25f9c7b3532630b5df
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Jun 28 17:43:20 2016 +0200

    Add rant why per-shot looks won't work after wasting afternoon on it.

    The tl;dr is that OCIO's documentation is extremely vague.

    Ref T2337

commit a3b224b6958db0c31a2df4ba47d19d87bf9f9833
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Jun 24 13:16:01 2016 +0200

    Fix loading of default gamut warning color.

    Always set the color space of the kocolor, kids.

    ref T2337

commit 652405d3acd67d4e87d788d0b77fb67768a5cc3b
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Jun 24 12:54:17 2016 +0200

    Add adaptation state slider.

    This allows you to set whether or not to adapt the white point, that is,
    to set the white point to the screen white(full slider) or to convert all whiteson screen to the white point of the profile when using absolute colorimetric
    as intent.

    This is useful to simulate paper-colour.

    Ref T2337

commit aea525ca6dc10b6867153da52fcf215a80adc0ba
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Fri Jun 24 10:32:37 2016 +0200

    Fix builds on gcc 6

commit 67f4e5a21f873f5a3d08d3bb90250cb5b5806e2b
Merge: 519f9c1 159a612
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 22:00:22 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 519f9c1fbe43edd6922b0cc5ef4ed85f17fd6dfc
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 19:49:56 2016 +0200

    Add option to set default Proofing Options.

    These will work for images with no proofing options, so, old loaded images
    and new images. With this it is feature complete, and people can start testing.

    Ref T2337
    Ref T1238

commit 062db74d24fb7e656e8a06cbddde560ab03166b6
Merge: 2e057e7 7625539
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 15:16:54 2016 +0200

    Merge branch 'master' into krita-testing-wolthera

commit 2e057e7a5339c3e3657fef562bbe716c672805b4
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 15:15:24 2016 +0200

    Clean up all the debug messages.

    It's... quieter in the terminal now.

    Ref T2337

commit 7ff7e60b5f423cdbeaa4089d8a6e7b2cd33129ca
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 15:01:02 2016 +0200

    Cleanup: Make projection color a defined tag.

commit 604efc8ddb21d38ad8a040b19ac7fa33cfe2e8d9
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 14:50:20 2016 +0200

    Not sure if this isn't the correct code instead...

    Ref T2337

commit 7c669703ff0c7fdf755d8070537c339bbcb02533
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 14:42:04 2016 +0200

    Load embedded proofing profiles if they exist, and add them to the profile registery.

    Needs testing for obvious reasons.

    Ref T2337

commit 119906b23bf0e1a3b8acfaf5828cdfcbaa92e77d
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 14:27:07 2016 +0200

    Add embedding of the proofing profile.

    This is so that we can later unembed them.

    Ref T2337

commit 9ef1dad773605e32d7018ccf7a90c1817d430d89
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 14:15:47 2016 +0200

    Load Warning Colors properly from file.

    Now the out of gamut warning can be written into file as XML
    and loaded from file as XML.

    Ref T2337

commit 6a57cf08fb170e4d32341ede0f3733be3ab1f37e
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 13:49:49 2016 +0200

    Fix naming conventions.

    I was using gamut warnings/alarms, and softproofing and soft proofing.

    The standard is (Out of )Gamut Warnings and Soft Proofing.

    Ref T2337

commit 4faa8b574da039d9dc86f099841bb901495e19a9
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 23 13:37:49 2016 +0200

    Disable softproofing in floating point spaces.

    There's a bunch of little niggling bugs that crop up when soft proofing
    in floating point spaces, amongst which the inability of the proofing
    mechanism to see floating point values higher than 1.0 fall outside of
    the gamut of the color space, let alone recognising whether it can go
    inside the gamut of the proofing space.

    See also http://ninedegreesbelow.com/bug-reports/soft-proofing-problems.html

    For now, it's best to disable softproofing on floating point spaces.
    Might need a more official check, though.

    Ref 2337

commit 91d7da8c41c4200729e87f98269fdf011422bb07
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Jun 22 16:26:52 2016 +0200

    Make views smart enough to track softproof/gamutcheck-state.

    Also add a floating message to say when the softproofing or gamutcheck
    is turned on in the view. Wording may change.

    Ref T2337

commit 5c48dd2c12e37ff0a75e098368449d260ff524bc
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Jun 22 16:26:35 2016 +0200

    Fix Build

commit 6bacfcda6005622669a3f4a47da59a759838797c
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Jun 22 14:45:52 2016 +0200

    Add attempt at saving color to xml.

    This fails due to me not being able to load the xml, due object-bonanza.

    ref T2337

commit 3bbf025b32ae53ff4601f188901541fcb80f63a7
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Jun 22 12:49:06 2016 +0200

    Intitial saving/loading of config.[unstable]

    Works, but might change later.

commit 1f733e28cb7f87fb4bea5a14159e86c5a5dd852f
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Jun 21 20:21:15 2016 +0200

    Refactor the proofing transform system for better caching.

    This now makes the transform separately from the actual transforming,
    which means it's easier to cache and to update. Softproofing is now
    gone from usable to user-friendly.

    Still needs saving/loading and little setting-bugs fixed.

    ref T2337

commit 8371c4179b1a8025e727528c5b7ce09ee3562ec9
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Jun 21 18:20:48 2016 +0200

    Enable Gamut color and proofing intent.

    The image now stored proofing intent, and the monitor intent is the general
    rendering intent.

    This also allows us to set the gamut warning color, however, for updating
    you currently need to switch profiles as well. I'll make a seperate
    generateSoftProofingTransform function, to cache the transform better, so it's
    easier to update.

    Ref 2337

commit 9d9ce38079c60ed04a63a2985a9c5ecb08652626
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Jun 21 14:18:05 2016 +0200

    Add softproofing section to image properties menu.

    Now, the proofing in the image can be changed.

    Also fixes that ugly little square problem with the kocoloractionpopup button.

    Ref T1238, T2337

commit 8d7b4418e798978ed5e4c9fbb28509e7b9e098d4
Merge: e2ee9ff d58645e
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 16 13:28:24 2016 +0200

    Merge remote-tracking branch 'origin/master' into krita-testing-wolthera

commit e2ee9ff5774c80ebb72c02bc02d8ce7a79ace72f
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Jun 14 15:56:50 2016 +0200

    Cache the transform unelegantly.

    This does cause a significant speed-up, but it's a bit fiddly.
    Regardless, the speed-up is enough to make this usable.

commit f643fc7bc2deb9317b6b7ef299f9d76a0c4e2160
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Jun 14 14:49:16 2016 +0200

    Fix softproofing

    It's slow again :/

commit cbc91c076310188456980563e3c061ca1a47147f
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Jun 14 12:45:43 2016 +0200

    Fix setting softproofing and gamutcheck flags.

commit 9ae336ed94207bab7885010720647814c9648e9d
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Tue Jun 14 12:44:50 2016 +0200

    Cache the color space engine to make it faster

    It doesn't fix everything, but it fixes quite a bit.
    Ref T210

commit d43589016b35ea85943c55ff244e83e6bc5cd15a
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Mon Jun 13 17:59:18 2016 +0200

    Add base implementation softproofing with toggles.

    It doesn't really work yet :/

    Ref: T210
    Ref: T2337

commit 7de0256960a6021591217ea3935dba1b39143b58
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Sun Jun 12 16:10:31 2016 +0200

    Create the proofing transform

    This doesn't use the caching graph stuff, which is too complex
    to refactor for now.

commit 00efd627af23f28555aa33a78a18fdd133934cf3
Author: Boudewijn Rempt <boud at valdyas.org>
Date:   Sun Jun 12 16:10:05 2016 +0200

    Add a per-image proofing settings class

commit d3bd5375b304dfea9282a9ad581130c7ddf8200a
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Sun Jun 12 14:44:50 2016 +0200

    Push work-in-progress proofing

commit bb97947abc29f76913924de9f1d2cb4a2762cf80
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 9 16:42:18 2016 +0200

    Fix copy-paste error

commit 9ed934a8206ea1e11077f9332252b465c0899d1f
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Thu Jun 9 16:30:09 2016 +0200

    Add OCIO Look support.

    The code is based of that of Blender, as I couldn't figure out how else to
    apply looks. The OCIO api wasn't clear about it, nor could I find much information,
    but it somewhat works and doesn't crash.

    Auditors: rempt, dkazakov
    Ref: T210

commit 2819ad66554f33e229729f8d86eb11a01413f23f
Author: Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>
Date:   Wed Jun 8 12:21:25 2016 +0200

    Add softproofing to the lcms conversion tests

    I am not fully sure if I understand the softproofing function, but the alarm works.

M  +2    -3    libs/pigment/KoColorConversions.cpp
M  +5    -0    libs/pigment/KoColorDisplayRendererInterface.cpp
M  +8    -0    libs/pigment/KoColorDisplayRendererInterface.h
M  +5    -2    libs/pigment/KoColorSpaceTraits.h
M  +31   -0    libs/pigment/resources/KoColorSet.cpp
M  +20   -0    libs/pigment/resources/KoColorSet.h
M  +8    -1    libs/ui/CMakeLists.txt
M  +1    -0    libs/ui/KisColorsetChooser.cpp
M  +1    -0    libs/ui/KisViewManager.cpp
M  +5    -0    libs/ui/KisViewManager.h
M  +4    -0    libs/ui/canvas/kis_display_color_converter.cpp
M  +16   -15   libs/ui/dialogs/kis_dlg_image_properties.cc
M  +0    -4    libs/ui/dialogs/kis_dlg_image_properties.h
A  +271  -0    libs/ui/dialogs/kis_dlg_internal_color_selector.cpp     [License: GPL (v2+)]
A  +171  -0    libs/ui/dialogs/kis_dlg_internal_color_selector.h     [License: GPL (v2+)]
M  +35   -22   libs/ui/dialogs/kis_dlg_layer_style.cpp
M  +41   -24   libs/ui/dialogs/kis_dlg_preferences.cc
M  +1    -4    libs/ui/dialogs/kis_dlg_preferences.h
M  +4    -5    libs/ui/forms/wdgautogradient.ui
M  +12   -12   libs/ui/forms/wdgcolorsettings.ui
M  +19   -17   libs/ui/forms/wdgdisplaysettings.ui
A  +237  -0    libs/ui/forms/wdgdlginternalcolorselector.ui
M  +8    -18   libs/ui/forms/wdggeneralsettings.ui
M  +29   -11   libs/ui/forms/wdgimageproperties.ui
M  +15   -16   libs/ui/forms/wdgnewimage.ui
M  +31   -26   libs/ui/forms/wdgpaintactioneditor.ui
M  +10   -16   libs/ui/kis_autogradient.cc
M  +2    -2    libs/ui/kis_autogradient.h
M  +23   -8    libs/ui/kis_control_frame.cpp
M  +4    -0    libs/ui/kis_control_frame.h
M  +19   -1    libs/ui/kis_custom_pattern.cc
M  +22   -5    libs/ui/kis_popup_palette.cpp
M  +2    -1    libs/ui/kis_popup_palette.h
M  +8    -9    libs/ui/layerstyles/WdgColorOverlay.ui
M  +6    -7    libs/ui/layerstyles/WdgSatin.ui
M  +13   -14   libs/ui/layerstyles/WdgStroke.ui
M  +7    -8    libs/ui/layerstyles/wdgBevelAndEmboss.ui
M  +8    -9    libs/ui/layerstyles/wdgInnerGlow.ui
M  +6    -7    libs/ui/layerstyles/wdgdropshadow.ui
M  +6    -12   libs/ui/recorder/kis_recorded_paint_action_editor.cc
M  +0    -2    libs/ui/recorder/kis_recorded_paint_action_editor.h
R  +63   -12   libs/ui/widgets/KoDualColorButton.cpp [from: libs/widgets/KoDualColorButton.cpp - 076% similarity]
R  +22   -3    libs/ui/widgets/KoDualColorButton.h [from: libs/widgets/KoDualColorButton.h - 087% similarity]
A  +340  -0    libs/ui/widgets/kis_color_button.cpp     [License: LGPL (v2+)]
A  +124  -0    libs/ui/widgets/kis_color_button.h     [License: LGPL (v2+)]
R  +0    -0    libs/ui/widgets/kis_color_input.cpp [from: plugins/dockers/specificcolorselector/kis_color_input.cc - 100% similarity]
R  +10   -9    libs/ui/widgets/kis_color_input.h [from: plugins/dockers/specificcolorselector/kis_color_input.h - 077% similarity]
M  +5    -3    libs/ui/widgets/kis_custom_image_widget.cc
A  +269  -0    libs/ui/widgets/kis_screen_color_picker.cpp     [License: GPL (v2+)]
A  +78   -0    libs/ui/widgets/kis_screen_color_picker.h     [License: GPL (v2+)]
A  +241  -0    libs/ui/widgets/kis_spinbox_color_selector.cpp     [License: GPL (v2+)]
A  +59   -0    libs/ui/widgets/kis_spinbox_color_selector.h     [License: GPL (v2+)]
A  +1602 -0    libs/ui/widgets/kis_visual_color_selector.cpp     [License: GPL (v2+)]
A  +447  -0    libs/ui/widgets/kis_visual_color_selector.h     [License: GPL (v2+)]
M  +0    -1    libs/widgets/CMakeLists.txt
M  +30   -3    libs/widgets/KoColorPatch.cpp
M  +16   -0    libs/widgets/KoColorPatch.h
M  +50   -3    libs/widgets/KoColorSetWidget.cpp
M  +9    -0    libs/widgets/KoColorSetWidget.h
M  +9    -0    libs/widgets/KoColorSetWidget_p.h
M  +17   -4    libs/widgets/KoEditColorSetDialog.cpp
M  +10   -6    plugins/dockers/animation/onion_skins_docker.cpp
M  +9    -14   plugins/dockers/animation/onion_skins_docker.ui
M  +15   -9    plugins/dockers/digitalmixer/digitalmixer_dock.cc
M  +2    -1    plugins/dockers/digitalmixer/digitalmixer_dock.h
M  +1    -0    plugins/dockers/palettedocker/palettedocker_dock.cpp
M  +46   -21   plugins/dockers/palettedocker/wdgpalettedock.ui
M  +5    -1    plugins/dockers/specificcolorselector/CMakeLists.txt
M  +5    -5    plugins/dockers/specificcolorselector/kis_specific_color_selector_widget.cc
M  +32   -1    plugins/extensions/layersplit/dlg_layersplit.cpp
M  +6    -1    plugins/extensions/layersplit/dlg_layersplit.h
M  +5    -1    plugins/extensions/layersplit/layersplit.cpp
M  +21   -2    plugins/extensions/layersplit/wdg_layersplit.ui
M  +17   -9    plugins/filters/colors/kis_wdg_color_to_alpha.cpp
M  +2    -2    plugins/filters/colors/kis_wdg_color_to_alpha.h
M  +9    -10   plugins/filters/colors/wdgcolortoalphabase.ui
M  +7    -5    plugins/filters/indexcolors/kiswdgindexcolors.cpp
M  +2    -2    plugins/filters/indexcolors/kiswdgindexcolors.h
M  +4    -4    plugins/generators/pattern/wdgpatternoptions.ui
M  +1    -1    plugins/generators/solid/colorgenerator.cpp
M  +6    -3    plugins/generators/solid/kis_wdg_color.cpp
M  +4    -1    plugins/generators/solid/kis_wdg_color.h
M  +3    -3    plugins/generators/solid/wdgcoloroptions.ui
M  +7    -3    plugins/impex/jpeg/kis_jpeg_export.cc
M  +9    -9    plugins/impex/jpeg/kis_wdg_options_jpeg.ui
M  +7    -3    plugins/impex/png/kis_png_export.cc
M  +5    -5    plugins/impex/png/kis_wdg_options_png.ui

http://commits.kde.org/krita/93ef7c8ef97e3ba5a1349ba38408269205a9d2b8

diff --git a/libs/pigment/KoColorConversions.cpp b/libs/pigment/KoColorConversions.cpp
index 0a00c33..085033a 100644
--- a/libs/pigment/KoColorConversions.cpp
+++ b/libs/pigment/KoColorConversions.cpp
@@ -382,9 +382,7 @@ void RGBToHSL(float r, float g, float b, float *h, float *s, float *l)
         *h = (r == m ? 3.0 + g2 : 5.0 - r2);
 
     *h *= 60;
-    if (*h == 360.) {
-        *h = 0;
-    }
+    *h = fmod(*h, 360.0);
 }
 
 void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b)
@@ -403,6 +401,7 @@ void HSLToRGB(float h, float sl, float l, float *r, float *g, float *b)
 
         m = l + l - v;
         sv = (v - m) / v;
+        h = fmod(h, 360.0);
         h /= 60.0;
         sextant = static_cast<int>(h);
         fract = h - sextant;
diff --git a/libs/pigment/KoColorDisplayRendererInterface.cpp b/libs/pigment/KoColorDisplayRendererInterface.cpp
index a0b42b1..fb6b0a9 100644
--- a/libs/pigment/KoColorDisplayRendererInterface.cpp
+++ b/libs/pigment/KoColorDisplayRendererInterface.cpp
@@ -78,3 +78,8 @@ qreal KoDumbColorDisplayRenderer::maxVisibleFloatValue(const KoChannelInfo *chan
     Q_ASSERT(chaninfo);
     return chaninfo->getUIMax();
 }
+
+const KoColorSpace* KoDumbColorDisplayRenderer::getPaintingColorSpace() const
+{
+    return KoColorSpaceRegistry::instance()->rgb8();
+}
diff --git a/libs/pigment/KoColorDisplayRendererInterface.h b/libs/pigment/KoColorDisplayRendererInterface.h
index e52e01f..2e97476 100644
--- a/libs/pigment/KoColorDisplayRendererInterface.h
+++ b/libs/pigment/KoColorDisplayRendererInterface.h
@@ -80,6 +80,12 @@ public:
      */
     virtual qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const = 0;
 
+    /**
+     * @brief getColorSpace
+     * @return the painting color space, this is useful for determining the transform.
+     */
+    virtual const KoColorSpace* getPaintingColorSpace() const = 0;
+
 Q_SIGNALS:
     void displayConfigurationChanged();
 
@@ -103,6 +109,8 @@ public:
     virtual qreal minVisibleFloatValue(const KoChannelInfo *chaninfo) const;
     virtual qreal maxVisibleFloatValue(const KoChannelInfo *chaninfo) const;
 
+    virtual const KoColorSpace* getPaintingColorSpace() const;
+
     static KoColorDisplayRendererInterface* instance();
 };
 
diff --git a/libs/pigment/KoColorSpaceTraits.h b/libs/pigment/KoColorSpaceTraits.h
index 1122353..73fec60 100644
--- a/libs/pigment/KoColorSpaceTraits.h
+++ b/libs/pigment/KoColorSpaceTraits.h
@@ -157,9 +157,12 @@ struct KoColorSpaceTrait {
         Q_ASSERT((int)values.count() == (int)channels_nb);
         channels_type c;
         for (uint i = 0; i < channels_nb; i++) {
-            c = (channels_type)
-                    ((float)KoColorSpaceMathsTraits<channels_type>::unitValue * values[i]);
+            float b = qBound((float)KoColorSpaceMathsTraits<channels_type>::min,
+                             (float)KoColorSpaceMathsTraits<channels_type>::unitValue * values[i],
+                             (float)KoColorSpaceMathsTraits<channels_type>::max);
+            c = (channels_type)b;
             nativeArray(pixel)[i] = c;
+
         }
     }
     inline static void multiplyAlpha(quint8 * pixels, quint8 alpha, qint32 nPixels) {
diff --git a/libs/pigment/resources/KoColorSet.cpp b/libs/pigment/resources/KoColorSet.cpp
index d4747e3..524e348 100644
--- a/libs/pigment/resources/KoColorSet.cpp
+++ b/libs/pigment/resources/KoColorSet.cpp
@@ -137,6 +137,37 @@ qint32 KoColorSet::nColors()
     return m_colors.count();
 }
 
+qint32 KoColorSet::getIndexClosestColor(KoColor color, bool useGivenColorSpace)
+{
+    qint32 closestIndex = 0;
+    quint8 highestPercentage = 0;
+    quint8 testPercentage = 0;
+    KoColor compare = color;
+    for (qint32 i=0; i<nColors(); i++) {
+        KoColor entry = m_colors.at(i).color;
+        if (useGivenColorSpace==true && compare.colorSpace()!=entry.colorSpace()) {
+            entry.convertTo(compare.colorSpace());
+
+        } else if(compare.colorSpace()!=entry.colorSpace()) {
+            compare.convertTo(entry.colorSpace());
+        }
+        testPercentage = (255 - compare.colorSpace()->difference(compare.data(), entry.data()));
+        if (testPercentage>highestPercentage)
+        {
+            closestIndex = i;
+            highestPercentage = testPercentage;
+        }
+    }
+    return closestIndex;
+}
+
+QString KoColorSet::closestColorName(KoColor color, bool useGivenColorSpace)
+{
+    int i = getIndexClosestColor(color, useGivenColorSpace);
+    QString name = m_colors.at(i).name;
+    return name;
+}
+
 bool KoColorSet::saveToDevice(QIODevice *dev) const
 {
     QTextStream stream(dev);
diff --git a/libs/pigment/resources/KoColorSet.h b/libs/pigment/resources/KoColorSet.h
index a87d104..af9f436 100644
--- a/libs/pigment/resources/KoColorSet.h
+++ b/libs/pigment/resources/KoColorSet.h
@@ -85,6 +85,26 @@ public:
     KoColorSetEntry getColor(quint32 index);
     qint32 nColors();
 
+    /**
+     * @brief getIndexClosestColor
+     * function that matches the color to all colors in the colorset, and returns the index
+     * of the closest match.
+     * @param color the color you wish to compare.
+     * @param useGivenColorSpace whether to use the color space of the color given
+     * when the two colors' colorspaces don't match. Else it'll use the entry's colorspace.
+     * @return returns the int of the closest match.
+     */
+    qint32 getIndexClosestColor(KoColor color, bool useGivenColorSpace = true);
+
+    /**
+     * @brief closestColorName
+     * convenience function to get the name of the closest match.
+     * @param color
+     * @param useGivenColorSpace
+     * @return
+     */
+    QString closestColorName(KoColor color, bool useGivenColorSpace = true);
+
 private:
 
 
diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
index 0cb23da..76df00d 100644
--- a/libs/ui/CMakeLists.txt
+++ b/libs/ui/CMakeLists.txt
@@ -66,6 +66,7 @@ set(kritaui_LIB_SRCS
     dialogs/kis_dlg_png_import.cpp
     dialogs/kis_dlg_import_image_sequence.cpp
     dialogs/kis_delayed_save_dialog.cpp
+    dialogs/kis_dlg_internal_color_selector.cpp
     flake/kis_node_dummies_graph.cpp
     flake/kis_dummies_facade_base.cpp
     flake/kis_dummies_facade.cpp
@@ -253,7 +254,12 @@ set(kritaui_LIB_SRCS
     widgets/kis_color_label_selector_widget.cpp
     widgets/kis_color_filter_combo.cpp
     widgets/kis_elided_label.cpp
-
+    widgets/kis_spinbox_color_selector.cpp
+    widgets/kis_screen_color_picker.cpp
+    widgets/kis_visual_color_selector.cpp
+    widgets/KoDualColorButton.cpp
+    widgets/kis_color_input.cpp
+    widgets/kis_color_button.cpp
     input/kis_input_manager.cpp
     input/kis_input_manager_p.cpp
     input/kis_extended_modifiers_mapper.cpp
@@ -455,6 +461,7 @@ ki18n_wrap_ui(kritaui_LIB_SRCS
     forms/KisDetailsPaneBase.ui
     forms/KisOpenPaneBase.ui
     brushhud/kis_dlg_brush_hud_config.ui
+    forms/wdgdlginternalcolorselector.ui
     dialogs/kis_delayed_save_dialog.ui
     input/config/kis_input_configuration_page.ui
     input/config/kis_edit_profiles_dialog.ui
diff --git a/libs/ui/KisColorsetChooser.cpp b/libs/ui/KisColorsetChooser.cpp
index 2f730f9..621ffa7 100644
--- a/libs/ui/KisColorsetChooser.cpp
+++ b/libs/ui/KisColorsetChooser.cpp
@@ -90,6 +90,7 @@ KisColorsetChooser::KisColorsetChooser(QWidget* parent): QWidget(parent)
     QSharedPointer<KoAbstractResourceServerAdapter> adapter(new KoResourceServerAdapter<KoColorSet>(rserver));
     m_itemChooser = new KoResourceItemChooser(adapter, this);
     m_itemChooser->setItemDelegate(new ColorSetDelegate(this));
+    m_itemChooser->showTaggingBar(true);
     m_itemChooser->setFixedSize(250, 250);
     m_itemChooser->setRowHeight(30);
     m_itemChooser->setColumnCount(1);
diff --git a/libs/ui/KisViewManager.cpp b/libs/ui/KisViewManager.cpp
index 4cfc936..b737b7a 100644
--- a/libs/ui/KisViewManager.cpp
+++ b/libs/ui/KisViewManager.cpp
@@ -440,6 +440,7 @@ void KisViewManager::setCurrentView(KisView *view)
 
     resourceProvider()->slotImageSizeChanged();
     resourceProvider()->slotOnScreenResolutionChanged();
+    Q_EMIT viewChanged();
 }
 
 
diff --git a/libs/ui/KisViewManager.h b/libs/ui/KisViewManager.h
index add5dc8..8657548 100644
--- a/libs/ui/KisViewManager.h
+++ b/libs/ui/KisViewManager.h
@@ -212,6 +212,11 @@ public Q_SLOTS:
 Q_SIGNALS:
 
     void floatingMessageRequested(const QString &message, const QString &iconName);
+    /**
+     * @brief viewChanged
+     * sent out when the view has changed.
+     */
+    void viewChanged();
 
 private Q_SLOTS:
 
diff --git a/libs/ui/canvas/kis_display_color_converter.cpp b/libs/ui/canvas/kis_display_color_converter.cpp
index 5fd4b32..a9188d3 100644
--- a/libs/ui/canvas/kis_display_color_converter.cpp
+++ b/libs/ui/canvas/kis_display_color_converter.cpp
@@ -141,6 +141,10 @@ struct KisDisplayColorConverter::Private
             return maxValue;
         }
 
+        virtual const KoColorSpace* getPaintingColorSpace() const {
+            return m_parent->paintingColorSpace();
+        }
+
     private:
         KisDisplayColorConverter *m_parent;
         QPointer<KoCanvasResourceManager> m_resourceManager;
diff --git a/libs/ui/dialogs/kis_dlg_image_properties.cc b/libs/ui/dialogs/kis_dlg_image_properties.cc
index 244cb97..ab3b110 100644
--- a/libs/ui/dialogs/kis_dlg_image_properties.cc
+++ b/libs/ui/dialogs/kis_dlg_image_properties.cc
@@ -68,18 +68,19 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent,
 
     m_page->lblResolutionValue->setText(QLocale().toString(image->xRes()*72, 2)); // XXX: separate values for x & y?
 
-    //Set the canvas projection color:
-    m_defaultColorAction = new KoColorPopupAction(this);
-    m_defaultColorAction->setCurrentColor(m_image->defaultProjectionColor());
-    m_defaultColorAction->setToolTip(i18n("Change the background color of the image"));
-    m_page->bnBackgroundColor->setDefaultAction(m_defaultColorAction);
+    //Set the canvas projection color:    backgroundColor
+    KoColor background = m_image->defaultProjectionColor();
+    background.setOpacity(1.0);
+    m_page->bnBackgroundColor->setColor(background);
+    m_page->sldBackgroundColor->setRange(0.0,1.0,2);
+    m_page->sldBackgroundColor->setSingleStep(0.05);
+    m_page->sldBackgroundColor->setValue(m_image->defaultProjectionColor().opacityF());
 
     KisSignalCompressor *compressor = new KisSignalCompressor(500 /* ms */, KisSignalCompressor::POSTPONE, this);
-    connect(m_defaultColorAction, SIGNAL(colorChanged(const KoColor&)), compressor, SLOT(start()));
+    connect(m_page->bnBackgroundColor, SIGNAL(changed(KoColor)), compressor, SLOT(start()));
+    connect(m_page->sldBackgroundColor, SIGNAL(valueChanged(qreal)), compressor, SLOT(start()));
     connect(compressor, SIGNAL(timeout()), this, SLOT(setCurrentColor()));
 
-    connect(m_defaultColorAction, SIGNAL(colorChanged(const KoColor&)), this, SLOT(setCurrentColor()));
-
     //Set the color space
     m_page->colorSpaceSelector->setCurrentColorSpace(image->colorSpace());
 
@@ -91,17 +92,15 @@ KisDlgImageProperties::KisDlgImageProperties(KisImageWSP image, QWidget *parent,
 
     m_page->ckbBlackPointComp->setChecked(m_proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::BlackpointCompensation));
 
-    m_gamutWarning = new KoColorPopupAction(this);
-    m_gamutWarning->setCurrentColor(m_proofingConfig->warningColor);
-    m_gamutWarning->setToolTip(i18n("Set color used for warning"));
-    m_page->gamutAlarm->setDefaultAction(m_gamutWarning);
+    m_page->gamutAlarm->setColor(m_proofingConfig->warningColor);
+    m_page->gamutAlarm->setToolTip(i18n("Set color used for warning"));
     m_page->sldAdaptationState->setMaximum(20);
     m_page->sldAdaptationState->setMinimum(0);
     m_page->sldAdaptationState->setValue((int)m_proofingConfig->adaptationState*20);
 
     KisSignalCompressor *softProofConfigCompressor = new KisSignalCompressor(500, KisSignalCompressor::POSTPONE,this);
 
-    connect(m_gamutWarning, SIGNAL(colorChanged(KoColor)), softProofConfigCompressor, SLOT(start()));
+    connect(m_page->gamutAlarm, SIGNAL(changed(KoColor)), softProofConfigCompressor, SLOT(start()));
     connect(m_page->proofSpaceSelector, SIGNAL(colorSpaceChanged(const KoColorSpace*)), softProofConfigCompressor, SLOT(start()));
     connect(m_page->cmbIntent, SIGNAL(currentIndexChanged(int)), softProofConfigCompressor, SLOT(start()));
     connect(m_page->ckbBlackPointComp, SIGNAL(stateChanged(int)), softProofConfigCompressor, SLOT(start()));
@@ -142,7 +141,9 @@ const KoColorSpace * KisDlgImageProperties::colorSpace()
 
 void KisDlgImageProperties::setCurrentColor()
 {
-    KisLayerUtils::changeImageDefaultProjectionColor(m_image, m_defaultColorAction->currentKoColor());
+    KoColor background = m_page->bnBackgroundColor->color();
+    background.setOpacity(m_page->sldBackgroundColor->value());
+    KisLayerUtils::changeImageDefaultProjectionColor(m_image, background);
 }
 
 void KisDlgImageProperties::setProofingConfig()
@@ -153,7 +154,7 @@ void KisDlgImageProperties::setProofingConfig()
     m_proofingConfig->proofingProfile = m_page->proofSpaceSelector->currentColorSpace()->profile()->name();
     m_proofingConfig->proofingModel = m_page->proofSpaceSelector->currentColorSpace()->colorModelId().id();
     m_proofingConfig->proofingDepth = "U8";//default to this
-    m_proofingConfig->warningColor = m_gamutWarning->currentKoColor();
+    m_proofingConfig->warningColor = m_page->gamutAlarm->color();
     m_proofingConfig->adaptationState = (double)m_page->sldAdaptationState->value()/20.0;
     qDebug()<<"set proofing config in properties: "<<m_proofingConfig->proofingProfile;
     m_image->setProofingConfiguration(m_proofingConfig);
diff --git a/libs/ui/dialogs/kis_dlg_image_properties.h b/libs/ui/dialogs/kis_dlg_image_properties.h
index 22b0dbb..4c35e89 100644
--- a/libs/ui/dialogs/kis_dlg_image_properties.h
+++ b/libs/ui/dialogs/kis_dlg_image_properties.h
@@ -24,8 +24,6 @@
 #include "ui_wdgimageproperties.h"
 
 class KoColorSpace;
-class KoColorPopupAction;
-
 class WdgImageProperties : public QWidget, public Ui::WdgImageProperties
 {
     Q_OBJECT
@@ -58,8 +56,6 @@ private:
 
     WdgImageProperties * m_page;
     KisImageWSP m_image;
-    KoColorPopupAction *m_defaultColorAction;
-    KoColorPopupAction *m_gamutWarning;
     KisProofingConfigurationSP m_proofingConfig;
 };
 
diff --git a/libs/ui/dialogs/kis_dlg_internal_color_selector.cpp b/libs/ui/dialogs/kis_dlg_internal_color_selector.cpp
new file mode 100644
index 0000000..8af2254
--- /dev/null
+++ b/libs/ui/dialogs/kis_dlg_internal_color_selector.cpp
@@ -0,0 +1,271 @@
+/*
+ * Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>, (C) 2016
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <QList>
+#include <QAbstractSpinBox>
+#include <QSpinBox>
+#include <QDoubleSpinBox>
+#include <QPointer>
+
+#include "KoColorSpaceRegistry.h"
+#include <KoColorSet.h>
+#include <KoResourceServerProvider.h>
+#include <KoResourceServer.h>
+
+#include "kis_signal_compressor.h"
+#include "KisViewManager.h"
+#include "KoColorDisplayRendererInterface.h"
+
+#include "kis_spinbox_color_selector.h"
+
+#include "kis_dlg_internal_color_selector.h"
+#include "ui_wdgdlginternalcolorselector.h"
+#include "kis_config.h"
+#include "kis_config_notifier.h"
+#include "kis_color_input.h"
+
+struct KisDlgInternalColorSelector::Private
+{
+    bool allowUpdates = true;
+    KoColor currentColor;
+    KoColor previousColor;
+    KoColor sRGB = KoColor(KoColorSpaceRegistry::instance()->rgb8());
+    const KoColorSpace *currentColorSpace;
+    bool lockUsedCS = false;
+    bool chooseAlpha = false;
+    KisSignalCompressor *compressColorChanges;
+    const KoColorDisplayRendererInterface *displayRenderer;
+    KisHexColorInput *hexColorInput;
+};
+
+KisDlgInternalColorSelector::KisDlgInternalColorSelector(QWidget *parent, KoColor color, Config config, const QString &caption, const KoColorDisplayRendererInterface *displayRenderer)
+    : QDialog(parent)
+     ,m_d(new Private)
+{
+    setModal(config.modal);
+    this->setFocusPolicy(Qt::ClickFocus);
+    m_ui = new Ui_WdgDlgInternalColorSelector();
+    m_ui->setupUi(this);
+
+    setWindowTitle(caption);
+
+    m_d->currentColor = color;
+    m_d->currentColorSpace = m_d->currentColor.colorSpace();
+    m_d->displayRenderer = displayRenderer;
+
+    m_ui->spinboxselector->slotSetColor(color);
+    connect(m_ui->spinboxselector, SIGNAL(sigNewColor(KoColor)), this, SLOT(slotColorUpdated(KoColor)));
+
+    m_ui->visualSelector->slotSetColor(color);
+    m_ui->visualSelector->setDisplayRenderer(displayRenderer);
+    m_ui->visualSelector->setConfig(false, config.modal);
+    if (config.visualColorSelector) {
+        connect(m_ui->visualSelector, SIGNAL(sigNewColor(KoColor)), this, SLOT(slotColorUpdated(KoColor)));
+        connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), m_ui->visualSelector, SLOT(ConfigurationChanged()));
+    } else {
+        m_ui->visualSelector->hide();
+    }
+    if (config.screenColorPicker) {
+        connect(m_ui->screenColorPicker, SIGNAL(sigNewColorPicked(KoColor)),this, SLOT(slotColorUpdated(KoColor)));
+    } else {
+        m_ui->screenColorPicker->hide();
+    }
+    //TODO: Add disable signal as well. Might be not necessary...?
+    KisConfig cfg;
+    QString paletteName = cfg.readEntry("internal_selector_active_color_set", QString());
+    KoResourceServer<KoColorSet>* rServer = KoResourceServerProvider::instance()->paletteServer(false);
+    KoColorSet *savedPal = rServer->resourceByName(paletteName);
+    if (savedPal) {
+        m_ui->paletteBox->setColorSet(savedPal);
+    } else {
+        savedPal = rServer->resources().first();
+        if (savedPal) {
+            m_ui->paletteBox->setColorSet(savedPal);
+        }
+    }
+    if (config.paletteBox) {
+        connect(m_ui->paletteBox, SIGNAL(colorChanged(KoColor,bool)), this, SLOT(slotColorUpdated(KoColor)));
+        m_ui->paletteBox->setDisplayRenderer(displayRenderer);
+    } else {
+        m_ui->paletteBox->hide();
+    }
+
+    if (config.prevNextButtons) {
+        m_ui->currentColor->setColor(m_d->currentColor);
+        m_ui->currentColor->setDisplayRenderer(displayRenderer);
+        m_ui->previousColor->setColor(m_d->currentColor);
+        m_ui->previousColor->setDisplayRenderer(displayRenderer);
+        connect(this, SIGNAL(accepted()), this, SLOT(setPreviousColor()));
+        connect(m_ui->previousColor, SIGNAL(triggered(KoColorPatch*)), SLOT(slotSetColorFromPatch(KoColorPatch*)));
+    } else {
+        m_ui->currentColor->hide();
+        m_ui->previousColor->hide();
+    }
+
+    if (config.hexInput) {
+        m_d->sRGB.fromKoColor(m_d->currentColor);
+        m_d->hexColorInput = new KisHexColorInput(this, &m_d->sRGB);
+        m_d->hexColorInput->update();
+        connect(m_d->hexColorInput, SIGNAL(updated()), SLOT(slotSetColorFromHex()));
+        m_ui->rightPane->addWidget(m_d->hexColorInput);
+        m_d->hexColorInput->setToolTip(i18n("This is a hexcode input, for webcolors. It can only get colors in the sRGB space."));
+    }
+
+    connect(this, SIGNAL(signalForegroundColorChosen(KoColor)), this, SLOT(slotLockSelector()));
+    m_d->compressColorChanges = new KisSignalCompressor(100 /* ms */, KisSignalCompressor::POSTPONE, this);
+    connect(m_d->compressColorChanges, SIGNAL(timeout()), this, SLOT(endUpdateWithNewColor()));
+
+    connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+    connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+}
+
+KisDlgInternalColorSelector::~KisDlgInternalColorSelector()
+{
+    delete m_ui;
+    //TODO: Does the scoped pointer also need to be deleted???
+}
+
+void KisDlgInternalColorSelector::slotColorUpdated(KoColor newColor)
+{
+    //if the update did not come from this selector...
+    if (m_d->allowUpdates || QObject::sender() == this->parent()) {
+        if (m_d->lockUsedCS){
+            newColor.convertTo(m_d->currentColorSpace);
+            m_d->currentColor = newColor;
+        } else {
+            m_d->currentColor = newColor;
+        }
+        updateAllElements(QObject::sender());
+    }
+}
+
+void KisDlgInternalColorSelector::colorSpaceChanged(const KoColorSpace *cs)
+{
+    if (cs == m_d->currentColorSpace) {
+        return;
+    }
+
+    m_d->currentColorSpace = KoColorSpaceRegistry::instance()->colorSpace(cs->colorModelId().id(), cs->colorDepthId().id(), cs->profile());
+    m_ui->spinboxselector->slotSetColorSpace(m_d->currentColorSpace);
+    m_ui->visualSelector->slotsetColorSpace(m_d->currentColorSpace);
+
+}
+
+void KisDlgInternalColorSelector::lockUsedColorSpace(const KoColorSpace *cs)
+{
+    colorSpaceChanged(cs);
+    m_d->lockUsedCS = true;
+}
+
+void KisDlgInternalColorSelector::setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer)
+{
+    if (displayRenderer) {
+        m_d->displayRenderer = displayRenderer;
+        m_ui->visualSelector->setDisplayRenderer(displayRenderer);
+        m_ui->currentColor->setDisplayRenderer(displayRenderer);
+        m_ui->previousColor->setDisplayRenderer(displayRenderer);
+        m_ui->paletteBox->setDisplayRenderer(displayRenderer);
+    } else {
+        m_d->displayRenderer = KoDumbColorDisplayRenderer::instance();
+    }
+}
+
+KoColor KisDlgInternalColorSelector::getModalColorDialog(const KoColor color, QWidget* parent, QString caption)
+{
+    Config config = Config();
+    KisDlgInternalColorSelector dialog(parent, color, config, caption);
+    dialog.exec();
+    return dialog.getCurrentColor();
+}
+
+KoColor KisDlgInternalColorSelector::getCurrentColor()
+{
+    return m_d->currentColor;
+}
+
+void KisDlgInternalColorSelector::chooseAlpha(bool chooseAlpha)
+{
+    m_d->chooseAlpha = chooseAlpha;
+}
+
+void KisDlgInternalColorSelector::slotConfigurationChanged()
+{
+    //m_d->canvas->displayColorConverter()->
+    //slotColorSpaceChanged(m_d->canvas->image()->colorSpace());
+}
+
+void KisDlgInternalColorSelector::slotLockSelector()
+{
+    m_d->allowUpdates = false;
+}
+
+void KisDlgInternalColorSelector::setPreviousColor()
+{
+    m_d->previousColor = m_d->currentColor;
+    KisConfig cfg;
+    if (m_ui->paletteBox->colorSet()) {
+        cfg.writeEntry("internal_selector_active_color_set", m_ui->paletteBox->colorSet()->name());
+    }
+}
+
+void KisDlgInternalColorSelector::updateAllElements(QObject *source)
+{
+    //update everything!!!
+    if (source != m_ui->spinboxselector) {
+        m_ui->spinboxselector->slotSetColor(m_d->currentColor);
+    }
+    if (source != m_ui->visualSelector) {
+        m_ui->visualSelector->slotSetColor(m_d->currentColor);
+    }
+
+    if (source != m_d->hexColorInput) {
+        m_d->sRGB.fromKoColor(m_d->currentColor);
+        m_d->hexColorInput->update();
+    }
+
+    m_ui->previousColor->setColor(m_d->previousColor);
+
+    m_ui->currentColor->setColor(m_d->currentColor);
+
+    if (source != this->parent()) {
+        emit(signalForegroundColorChosen(m_d->currentColor));
+        m_d->compressColorChanges->start();
+    }
+}
+
+
+void KisDlgInternalColorSelector::endUpdateWithNewColor()
+{
+    m_d->allowUpdates = true;
+}
+
+void KisDlgInternalColorSelector::focusInEvent(QFocusEvent *)
+{
+    //setPreviousColor();
+}
+
+void KisDlgInternalColorSelector::slotSetColorFromPatch(KoColorPatch* patch)
+{
+    slotColorUpdated(patch->color());
+}
+
+void KisDlgInternalColorSelector::slotSetColorFromHex()
+{
+    slotColorUpdated(m_d->sRGB);
+}
+
diff --git a/libs/ui/dialogs/kis_dlg_internal_color_selector.h b/libs/ui/dialogs/kis_dlg_internal_color_selector.h
new file mode 100644
index 0000000..07fc5f4
--- /dev/null
+++ b/libs/ui/dialogs/kis_dlg_internal_color_selector.h
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>, (C) 2016
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KISINTERNALCOLORSELECTOR_H
+#define KISINTERNALCOLORSELECTOR_H
+
+#include "kritaui_export.h"
+#include "KoColor.h"
+#include "KoColorSpace.h"
+#include "KoColorDisplayRendererInterface.h"
+
+#include <QScopedPointer>
+
+#include "ui_wdgdlginternalcolorselector.h"
+
+/**
+ * @brief The KisInternalColorSelector class
+ *
+ * A non-modal color selector dialog that is not a plugin and can thus be used for filters.
+ */
+class KRITAUI_EXPORT KisDlgInternalColorSelector : public QDialog
+{
+    Q_OBJECT
+public:
+    struct Config
+    {
+        Config() :
+            modal(true),
+            visualColorSelector(true),
+            paletteBox(true),
+            screenColorPicker(true),
+            prevNextButtons(true),
+            hexInput(true),
+            useAlpha(false){}
+        bool modal;
+        bool visualColorSelector;
+        bool paletteBox;
+        bool screenColorPicker;
+        bool prevNextButtons;
+        bool hexInput;
+        bool useAlpha;
+    };
+
+    KisDlgInternalColorSelector(QWidget* parent, KoColor color, Config config, const QString &caption, const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
+    ~KisDlgInternalColorSelector();
+
+    /**
+     * @brief slotColorSpaceChanged
+     * Color space has changed, use this dialog to change the colorspace.
+     */
+    void colorSpaceChanged(const KoColorSpace *cs);
+
+    /**
+     * @brief lockUsedColorSpace
+     * Lock the used colorspace of this selector.
+     * @param cs
+     */
+    void lockUsedColorSpace(const KoColorSpace *cs);
+
+    /**
+     * @brief setDisplayRenderer
+     * Set the display renderer. This is necessary for HDR color manage support.
+     * @param displayRenderer
+     */
+    void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer);
+
+    /**
+     * @brief getModalColorDialog
+     * Excecute this dialog modally. The function returns
+     * the KoColor you want.
+     * @param color - The current color. Make sure this is in the color space you want your
+     * end color to be in.
+     * @param chooseAlpha - Whether or not the alpha-choosing functionality should be used.
+     */
+    static KoColor getModalColorDialog(const KoColor color, QWidget* parent = Q_NULLPTR, QString caption = QString());
+
+    /**
+     * @brief getCurrentColor
+     * @return gives currently active color;
+     */
+    KoColor getCurrentColor();
+
+    void chooseAlpha(bool chooseAlpha);
+
+Q_SIGNALS:
+    /**
+     * @brief signalForegroundColorChosen
+     * The most important signal. This will sent out when a color has been picked from the selector.
+     * There will be a small delay to make sure that the selector causes too many updates.
+     *
+     * Do not connect this to slotColorUpdated.
+     * @param color The new color chosen
+     */
+
+    void signalForegroundColorChosen(KoColor color);
+public Q_SLOTS:
+    /**
+     * @brief slotColorUpdated
+     * Very important slot. Is connected to krita's resources to make sure it has
+     * the currently active color. It's very important that this function is able to understand
+     * when the signal came from itself.
+     * @param newColor This is the new color.
+     */
+    void slotColorUpdated(KoColor newColor);
+private Q_SLOTS:
+
+    /**
+     * @brief slotLockSelector
+     * This slot will prevent the color from being updated.
+     */
+    void slotLockSelector();
+
+    /**
+     * @brief slotConfigurationChanged
+     * Wrapper slot for changes to the colorspace.
+     */
+    void slotConfigurationChanged();
+
+    void endUpdateWithNewColor();
+
+    /**
+     * @brief setPreviousColor
+     * triggered when the dialog is either accepted or hidden.
+     */
+    void setPreviousColor();
+
+    /**
+     * @brief slotSetColorFromPatch
+     * update current color from kocolorpatch.
+     * @param patch
+     */
+    void slotSetColorFromPatch(KoColorPatch* patch);
+
+    /**
+     * @brief slotSetColorFromHex
+     * Update from the hex color input.
+     */
+    void slotSetColorFromHex();
+
+
+private:
+    Ui_WdgDlgInternalColorSelector *m_ui; //the UI
+    struct Private; //The private struct
+    const QScopedPointer<Private> m_d; //the private pointer
+
+    /**
+     * @brief updateAllElements
+     * Updates each widget with the new element, and if it's responsible for the update sents
+     * a signal out that there's a new color.
+     */
+    void updateAllElements(QObject *source);
+
+    virtual void focusInEvent(QFocusEvent *);
+};
+
+#endif // KISINTERNALCOLORSELECTOR_H
diff --git a/libs/ui/dialogs/kis_dlg_layer_style.cpp b/libs/ui/dialogs/kis_dlg_layer_style.cpp
index 9de074c..c7bd978 100644
--- a/libs/ui/dialogs/kis_dlg_layer_style.cpp
+++ b/libs/ui/dialogs/kis_dlg_layer_style.cpp
@@ -31,6 +31,7 @@
 
 
 #include <KoColorPopupButton.h>
+#include <KoColorSpaceRegistry.h>
 #include <KoResourceServerProvider.h>
 
 #include "kis_config.h"
@@ -619,10 +620,10 @@ BevelAndEmboss::BevelAndEmboss(Contour *contour, Texture *texture, QWidget *pare
     connect(ui.cmbContour, SIGNAL(currentIndexChanged(int)), SIGNAL(configChanged()));
     connect(ui.chkAntiAliased, SIGNAL(toggled(bool)), SIGNAL(configChanged()));
     connect(ui.cmbHighlightMode, SIGNAL(currentIndexChanged(int)), SIGNAL(configChanged()));
-    connect(ui.bnHighlightColor, SIGNAL(changed(QColor)), SIGNAL(configChanged()));
+    connect(ui.bnHighlightColor, SIGNAL(changed(KoColor)), SIGNAL(configChanged()));
     connect(ui.intOpacity, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));
     connect(ui.cmbShadowMode, SIGNAL(currentIndexChanged(int)), SIGNAL(configChanged()));
-    connect(ui.bnShadowColor, SIGNAL(changed(QColor)), SIGNAL(configChanged()));
+    connect(ui.bnShadowColor, SIGNAL(changed(KoColor)), SIGNAL(configChanged()));
     connect(ui.intOpacity2, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));;
 
     // Contour
@@ -664,10 +665,13 @@ void BevelAndEmboss::setBevelAndEmboss(const psd_layer_effects_bevel_emboss *bev
     // ui.cmbContour;
     ui.chkAntiAliased->setChecked(bevelAndEmboss->glossAntiAliased());
     ui.cmbHighlightMode->selectCompositeOp(KoID(bevelAndEmboss->highlightBlendMode()));
-    ui.bnHighlightColor->setColor(bevelAndEmboss->highlightColor());
+    KoColor highlightshadow(KoColorSpaceRegistry::instance()->rgb8());
+    highlightshadow.fromQColor(bevelAndEmboss->highlightColor());
+    ui.bnHighlightColor->setColor(highlightshadow);
     ui.intOpacity->setValue(bevelAndEmboss->highlightOpacity());
     ui.cmbShadowMode->selectCompositeOp(KoID(bevelAndEmboss->shadowBlendMode()));
-    ui.bnShadowColor->setColor(bevelAndEmboss->shadowColor());
+    highlightshadow.fromQColor(bevelAndEmboss->shadowColor());
+    ui.bnShadowColor->setColor(highlightshadow);
     ui.intOpacity2->setValue(bevelAndEmboss->shadowOpacity());
 
     // FIXME: curve editing
@@ -696,10 +700,10 @@ void BevelAndEmboss::fetchBevelAndEmboss(psd_layer_effects_bevel_emboss *bevelAn
     bevelAndEmboss->setAltitude(ui.intAltitude->value());
     bevelAndEmboss->setGlossAntiAliased(ui.chkAntiAliased->isChecked());
     bevelAndEmboss->setHighlightBlendMode(ui.cmbHighlightMode->selectedCompositeOp().id());
-    bevelAndEmboss->setHighlightColor(ui.bnHighlightColor->color());
+    bevelAndEmboss->setHighlightColor(ui.bnHighlightColor->color().toQColor());
     bevelAndEmboss->setHighlightOpacity(ui.intOpacity->value());
     bevelAndEmboss->setShadowBlendMode(ui.cmbShadowMode->selectedCompositeOp().id());
-    bevelAndEmboss->setShadowColor(ui.bnShadowColor->color());
+    bevelAndEmboss->setShadowColor(ui.bnShadowColor->color().toQColor());
     bevelAndEmboss->setShadowOpacity(ui.intOpacity2->value());
 
     // FIXME: curve editing
@@ -792,21 +796,23 @@ ColorOverlay::ColorOverlay(QWidget *parent)
 
     connect(ui.cmbCompositeOp, SIGNAL(currentIndexChanged(int)), SIGNAL(configChanged()));
     connect(ui.intOpacity, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));
-    connect(ui.bnColor, SIGNAL(changed(QColor)), SIGNAL(configChanged()));
+    connect(ui.bnColor, SIGNAL(changed(KoColor)), SIGNAL(configChanged()));
 }
 
 void ColorOverlay::setColorOverlay(const psd_layer_effects_color_overlay *colorOverlay)
 {
     ui.cmbCompositeOp->selectCompositeOp(KoID(colorOverlay->blendMode()));
     ui.intOpacity->setValue(colorOverlay->opacity());
-    ui.bnColor->setColor(colorOverlay->color());
+    KoColor color(KoColorSpaceRegistry::instance()->rgb8());
+    color.fromQColor(colorOverlay->color());
+    ui.bnColor->setColor(color);
 }
 
 void ColorOverlay::fetchColorOverlay(psd_layer_effects_color_overlay *colorOverlay) const
 {
     colorOverlay->setBlendMode(ui.cmbCompositeOp->selectedCompositeOp().id());
     colorOverlay->setOpacity(ui.intOpacity->value());
-    colorOverlay->setColor(ui.bnColor->color());
+    colorOverlay->setColor(ui.bnColor->color().toQColor());
 }
 
 
@@ -843,7 +849,7 @@ DropShadow::DropShadow(Mode mode, QWidget *parent)
     // connect everything to configChanged() signal
     connect(ui.cmbCompositeOp, SIGNAL(currentIndexChanged(int)), SIGNAL(configChanged()));
     connect(ui.intOpacity, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));
-    connect(ui.bnColor, SIGNAL(changed(QColor)), SIGNAL(configChanged()));
+    connect(ui.bnColor, SIGNAL(changed(KoColor)), SIGNAL(configChanged()));
 
     connect(ui.dialAngle, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));
     connect(ui.intAngle, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));
@@ -897,7 +903,9 @@ void DropShadow::setShadow(const psd_layer_effects_shadow_common *shadow)
 {
     ui.cmbCompositeOp->selectCompositeOp(KoID(shadow->blendMode()));
     ui.intOpacity->setValue(shadow->opacity());
-    ui.bnColor->setColor(shadow->color());
+    KoColor color(KoColorSpaceRegistry::instance()->rgb8());
+    color.fromQColor(shadow->color());
+    ui.bnColor->setColor(color);
 
     ui.dialAngle->setValue(shadow->angle());
     ui.intAngle->setValue(shadow->angle());
@@ -925,7 +933,7 @@ void DropShadow::fetchShadow(psd_layer_effects_shadow_common *shadow) const
 {
     shadow->setBlendMode(ui.cmbCompositeOp->selectedCompositeOp().id());
     shadow->setOpacity(ui.intOpacity->value());
-    shadow->setColor(ui.bnColor->color());
+    shadow->setColor(ui.bnColor->color().toQColor());
 
     shadow->setAngle(ui.dialAngle->value());
     shadow->setUseGlobalLight(ui.chkUseGlobalLight->isChecked());
@@ -1092,7 +1100,7 @@ InnerGlow::InnerGlow(Mode mode, KisCanvasResourceProvider *resourceProvider, QWi
     connect(ui.intNoise, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));
 
     connect(ui.radioColor, SIGNAL(toggled(bool)), SIGNAL(configChanged()));
-    connect(ui.bnColor, SIGNAL(changed(QColor)), SIGNAL(configChanged()));
+    connect(ui.bnColor, SIGNAL(changed(KoColor)), SIGNAL(configChanged()));
     connect(ui.radioGradient, SIGNAL(toggled(bool)), SIGNAL(configChanged()));
     connect(ui.cmbGradient, SIGNAL(gradientChanged(KoAbstractGradient*)), SIGNAL(configChanged()));
 
@@ -1121,7 +1129,9 @@ void InnerGlow::setConfig(const psd_layer_effects_glow_common *config)
     ui.intNoise->setValue(config->noise());
 
     ui.radioColor->setChecked(config->fillType() == psd_fill_solid_color);
-    ui.bnColor->setColor(config->color());
+    KoColor color(KoColorSpaceRegistry::instance()->rgb8());
+    color.fromQColor(config->color());
+    ui.bnColor->setColor(color);
     ui.radioGradient->setChecked(config->fillType() == psd_fill_gradient);
 
     KoAbstractGradient *gradient = fetchGradientLazy(
@@ -1164,7 +1174,7 @@ void InnerGlow::fetchConfig(psd_layer_effects_glow_common *config) const
         config->setFillType(psd_fill_gradient);
     }
 
-    config->setColor(ui.bnColor->color());
+    config->setColor(ui.bnColor->color().toQColor());
     config->setGradient(GradientPointerConverter::resourceToStyle(ui.cmbGradient->gradient()));
     config->setTechnique((psd_technique_type)ui.cmbTechnique->currentIndex());
     config->setSpread(ui.intChoke->value());
@@ -1251,7 +1261,7 @@ Satin::Satin(QWidget *parent)
     connect(ui.intAngle, SIGNAL(valueChanged(int)), SLOT(slotIntAngleChanged(int)));
 
     connect(ui.cmbCompositeOp, SIGNAL(currentIndexChanged(int)), SIGNAL(configChanged()));
-    connect(ui.bnColor, SIGNAL(changed(QColor)), SIGNAL(configChanged()));
+    connect(ui.bnColor, SIGNAL(changed(KoColor)), SIGNAL(configChanged()));
     connect(ui.intOpacity, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));
 
     connect(ui.dialAngle, SIGNAL(valueChanged(int)), SIGNAL(configChanged()));
@@ -1280,7 +1290,9 @@ void Satin::slotIntAngleChanged(int value)
 void Satin::setSatin(const psd_layer_effects_satin *satin)
 {
     ui.cmbCompositeOp->selectCompositeOp(KoID(satin->blendMode()));
-    ui.bnColor->setColor(satin->color());
+    KoColor color(KoColorSpaceRegistry::instance()->rgb8());
+    color.fromQColor(satin->color());
+    ui.bnColor->setColor(color);
     ui.intOpacity->setValue(satin->opacity());
 
     ui.dialAngle->setValue(satin->angle());
@@ -1301,7 +1313,7 @@ void Satin::fetchSatin(psd_layer_effects_satin *satin) const
 {
     satin->setBlendMode(ui.cmbCompositeOp->selectedCompositeOp().id());
     satin->setOpacity(ui.intOpacity->value());
-    satin->setColor(ui.bnColor->color());
+    satin->setColor(ui.bnColor->color().toQColor());
 
     satin->setAngle(ui.dialAngle->value());
 
@@ -1345,7 +1357,7 @@ Stroke::Stroke(KisCanvasResourceProvider *resourceProvider, QWidget *parent)
 
     connect(ui.cmbFillType, SIGNAL(currentIndexChanged(int)), SIGNAL(configChanged()));
 
-    connect(ui.bnColor, SIGNAL(changed(QColor)), SIGNAL(configChanged()));
+    connect(ui.bnColor, SIGNAL(changed(KoColor)), SIGNAL(configChanged()));
 
     connect(ui.cmbGradient, SIGNAL(gradientChanged(KoAbstractGradient*)), SIGNAL(configChanged()));
     connect(ui.chkReverse, SIGNAL(toggled(bool)), SIGNAL(configChanged()));
@@ -1385,8 +1397,9 @@ void Stroke::setStroke(const psd_layer_effects_stroke *stroke)
     ui.intOpacity->setValue(stroke->opacity());
 
     ui.cmbFillType->setCurrentIndex((int)stroke->fillType());
-
-    ui.bnColor->setColor(stroke->color());
+    KoColor color(KoColorSpaceRegistry::instance()->rgb8());
+    color.fromQColor(stroke->color());
+    ui.bnColor->setColor(color);
 
     KoAbstractGradient *gradient =
         fetchGradientLazy(GradientPointerConverter::styleToResource(stroke->gradient()), m_resourceProvider);
@@ -1417,7 +1430,7 @@ void Stroke::fetchStroke(psd_layer_effects_stroke *stroke) const
 
     stroke->setFillType((psd_fill_type)ui.cmbFillType->currentIndex());
 
-    stroke->setColor(ui.bnColor->color());
+    stroke->setColor(ui.bnColor->color().toQColor());
 
     stroke->setGradient(GradientPointerConverter::resourceToStyle(ui.cmbGradient->gradient()));
     stroke->setReverse(ui.chkReverse->isChecked());
diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc
index 8c1ceab..f97411e 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.cc
+++ b/libs/ui/dialogs/kis_dlg_preferences.cc
@@ -117,7 +117,9 @@ GeneralTab::GeneralTab(QWidget *_parent, const char *_name)
     m_cmbMDIType->setCurrentIndex(cfg.readEntry<int>("mdi_viewmode", (int)QMdiArea::TabbedView));
     m_chkRubberBand->setChecked(cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
     m_favoritePresetsSpinBox->setValue(cfg.favoritePresets());
-    m_mdiColor->setColor(cfg.getMDIBackgroundColor());
+    KoColor mdiColor;
+    mdiColor.fromQColor(cfg.getMDIBackgroundColor());
+    m_mdiColor->setColor(mdiColor);
     m_backgroundimage->setText(cfg.getMDIBackgroundImage());
     m_chkCanvasMessages->setChecked(cfg.showCanvasMessages());
     m_chkCompressKra->setChecked(cfg.compressKra());
@@ -146,7 +148,9 @@ void GeneralTab::setDefault()
     m_cmbMDIType->setCurrentIndex((int)QMdiArea::TabbedView);
     m_chkRubberBand->setChecked(cfg.useOpenGL(true));
     m_favoritePresetsSpinBox->setValue(cfg.favoritePresets(true));
-    m_mdiColor->setColor(cfg.getMDIBackgroundColor(true));
+    KoColor mdiColor;
+    mdiColor.fromQColor(cfg.getMDIBackgroundColor(true));
+    m_mdiColor->setColor(mdiColor);
     m_backgroundimage->setText(cfg.getMDIBackgroundImage(true));
     m_chkCanvasMessages->setChecked(cfg.showCanvasMessages(true));
     m_chkCompressKra->setChecked(cfg.compressKra(true));
@@ -339,10 +343,6 @@ ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
     KisImageConfig cfgImage;
 
     KisProofingConfigurationSP proofingConfig = cfgImage.defaultProofingconfiguration();
-    m_gamutWarning = new KoColorPopupAction(this);
-    m_gamutWarning->setToolTip(i18n("Set default color used for out of Gamut Warning"));
-    m_gamutWarning->setCurrentColor(proofingConfig->warningColor);
-    m_page->gamutAlarm->setDefaultAction(m_gamutWarning);
     m_page->sldAdaptationState->setMaximum(20);
     m_page->sldAdaptationState->setMinimum(0);
     m_page->sldAdaptationState->setValue((int)proofingConfig->adaptationState*20);
@@ -450,7 +450,10 @@ void ColorSettingsTab::setDefault()
     m_page->ckbProofBlackPoint->setChecked(proofingConfig->conversionFlags.testFlag(KoColorConversionTransformation::BlackpointCompensation));
     m_page->sldAdaptationState->setValue(0);
 
-    m_gamutWarning->setCurrentColor(proofingConfig->warningColor);
+    //probably this should become the screenprofile?
+    KoColor ga(KoColorSpaceRegistry::instance()->rgb8());
+    ga.fromKoColor(proofingConfig->warningColor);
+    m_page->gamutAlarm->setColor(ga);
 
     m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation(true));
     m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization(true));
@@ -665,7 +668,6 @@ void PerformanceTab::selectSwapDir()
 //---------------------------------------------------------------------------------------------------
 
 #include "KoColor.h"
-#include "KoColorPopupAction.h"
 
 DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
     : WdgDisplaySettings(parent, name)
@@ -700,16 +702,23 @@ DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
 
     KoColor c;
     c.fromQColor(cfg.selectionOverlayMaskColor());
-    m_selectionOverlayColorAction = new KoColorPopupAction(this);
-    m_selectionOverlayColorAction->setCurrentColor(c);
-    m_selectionOverlayColorAction->setToolTip(i18n("Change the background color of the image"));
-    btnSelectionOverlayColor->setDefaultAction(m_selectionOverlayColorAction);
+    c.setOpacity(1.0);
+    btnSelectionOverlayColor->setColor(c);
+    sldSelectionOverlayOpacity->setRange(0.0, 1.0, 2);
+    sldSelectionOverlayOpacity->setSingleStep(0.05);
+    sldSelectionOverlayOpacity->setValue(cfg.selectionOverlayMaskColor().alphaF());
 
     intCheckSize->setValue(cfg.checkSize());
     chkMoving->setChecked(cfg.scrollCheckers());
-    colorChecks1->setColor(cfg.checkersColor1());
-    colorChecks2->setColor(cfg.checkersColor2());
-    canvasBorder->setColor(cfg.canvasBorderColor());
+    KoColor ck1(KoColorSpaceRegistry::instance()->rgb8());
+    ck1.fromQColor(cfg.checkersColor1());
+    colorChecks1->setColor(ck1);
+    KoColor ck2(KoColorSpaceRegistry::instance()->rgb8());
+    ck2.fromQColor(cfg.checkersColor2());
+    colorChecks2->setColor(ck2);
+    KoColor cb(KoColorSpaceRegistry::instance()->rgb8());
+    cb.fromQColor(cfg.canvasBorderColor());
+    canvasBorder->setColor(cb);
     hideScrollbars->setChecked(cfg.hideScrollbars());
     chkCurveAntialiasing->setChecked(cfg.antialiasCurves());
     chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline());
@@ -742,9 +751,15 @@ void DisplaySettingsTab::setDefault()
 
     chkMoving->setChecked(cfg.scrollCheckers(true));
     intCheckSize->setValue(cfg.checkSize(true));
-    colorChecks1->setColor(cfg.checkersColor1(true));
-    colorChecks2->setColor(cfg.checkersColor2(true));
-    canvasBorder->setColor(cfg.canvasBorderColor(true));
+    KoColor ck1(KoColorSpaceRegistry::instance()->rgb8());
+    ck1.fromQColor(cfg.checkersColor1(true));
+    colorChecks1->setColor(ck1);
+    KoColor ck2(KoColorSpaceRegistry::instance()->rgb8());
+    ck2.fromQColor(cfg.checkersColor2(true));
+    colorChecks2->setColor(ck2);
+    KoColor cvb(KoColorSpaceRegistry::instance()->rgb8());
+    cvb.fromQColor(cfg.canvasBorderColor(true));
+    canvasBorder->setColor(cvb);
     hideScrollbars->setChecked(cfg.hideScrollbars(true));
     chkCurveAntialiasing->setChecked(cfg.antialiasCurves(true));
     chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline(true));
@@ -950,7 +965,7 @@ bool KisDlgPreferences::editPreferences()
         cfg.setShowOutlineWhilePainting(dialog->m_general->showOutlineWhilePainting());
         cfg.setHideSplashScreen(dialog->m_general->hideSplashScreen());
         cfg.writeEntry<int>("mdi_viewmode", dialog->m_general->mdiMode());
-        cfg.setMDIBackgroundColor(dialog->m_general->m_mdiColor->color());
+        cfg.setMDIBackgroundColor(dialog->m_general->m_mdiColor->color().toQColor());
         cfg.setMDIBackgroundImage(dialog->m_general->m_backgroundimage->text());
         cfg.setAutoSaveInterval(dialog->m_general->autoSaveInterval());
         cfg.setBackupFile(dialog->m_general->m_backupFileCheckBox->isChecked());
@@ -990,7 +1005,7 @@ bool KisDlgPreferences::editPreferences()
         cfg.setWorkingColorSpace(dialog->m_colorSettings->m_page->cmbWorkingColorSpace->currentItem().id());
 
         KisImageConfig cfgImage;
-        cfgImage.setDefaultProofingConfig(dialog->m_colorSettings->m_page->proofingSpaceSelector->currentColorSpace(), dialog->m_colorSettings->m_page->cmbProofingIntent->currentIndex(), dialog->m_colorSettings->m_page->ckbProofBlackPoint->isChecked(), dialog->m_colorSettings->m_gamutWarning->currentKoColor(), (double)dialog->m_colorSettings->m_page->sldAdaptationState->value()/20);
+        cfgImage.setDefaultProofingConfig(dialog->m_colorSettings->m_page->proofingSpaceSelector->currentColorSpace(), dialog->m_colorSettings->m_page->cmbProofingIntent->currentIndex(), dialog->m_colorSettings->m_page->ckbProofBlackPoint->isChecked(), dialog->m_colorSettings->m_page->gamutAlarm->color(), (double)dialog->m_colorSettings->m_page->sldAdaptationState->value()/20);
         cfg.setUseBlackPointCompensation(dialog->m_colorSettings->m_page->chkBlackpoint->isChecked());
         cfg.setAllowLCMSOptimization(dialog->m_colorSettings->m_page->chkAllowLCMSOptimization->isChecked());
         cfg.setPasteBehaviour(dialog->m_colorSettings->m_pasteBehaviourGroup.checkedId());
@@ -1010,11 +1025,13 @@ bool KisDlgPreferences::editPreferences()
 
         cfg.setCheckSize(dialog->m_displaySettings->intCheckSize->value());
         cfg.setScrollingCheckers(dialog->m_displaySettings->chkMoving->isChecked());
-        cfg.setCheckersColor1(dialog->m_displaySettings->colorChecks1->color());
-        cfg.setCheckersColor2(dialog->m_displaySettings->colorChecks2->color());
-        cfg.setCanvasBorderColor(dialog->m_displaySettings->canvasBorder->color());
+        cfg.setCheckersColor1(dialog->m_displaySettings->colorChecks1->color().toQColor());
+        cfg.setCheckersColor2(dialog->m_displaySettings->colorChecks2->color().toQColor());
+        cfg.setCanvasBorderColor(dialog->m_displaySettings->canvasBorder->color().toQColor());
         cfg.setHideScrollbars(dialog->m_displaySettings->hideScrollbars->isChecked());
-        cfg.setSelectionOverlayMaskColor(dialog->m_displaySettings->m_selectionOverlayColorAction->currentKoColor().toQColor());
+        KoColor c = dialog->m_displaySettings->btnSelectionOverlayColor->color();
+        c.setOpacity(dialog->m_displaySettings->sldSelectionOverlayOpacity->value());
+        cfg.setSelectionOverlayMaskColor(c.toQColor());
         cfg.setAntialiasCurves(dialog->m_displaySettings->chkCurveAntialiasing->isChecked());
         cfg.setAntialiasSelectionOutline(dialog->m_displaySettings->chkSelectionOutlineAntialiasing->isChecked());
         cfg.setShowSingleChannelAsColor(dialog->m_displaySettings->chkChannelsAsColor->isChecked());
diff --git a/libs/ui/dialogs/kis_dlg_preferences.h b/libs/ui/dialogs/kis_dlg_preferences.h
index ea04494..1fdcccb 100644
--- a/libs/ui/dialogs/kis_dlg_preferences.h
+++ b/libs/ui/dialogs/kis_dlg_preferences.h
@@ -25,9 +25,9 @@
 #include <QWidget>
 
 #include <kpagedialog.h>
-#include "KoColorPopupAction.h"
 
 #include "kis_global.h"
+#include "widgets/squeezedcombobox.h"
 
 #include "ui_wdggeneralsettings.h"
 #include "ui_wdgdisplaysettings.h"
@@ -156,7 +156,6 @@ private Q_SLOTS:
 public:
     void setDefault();
     WdgColorSettings  *m_page;
-    KoColorPopupAction *m_gamutWarning;
     QButtonGroup m_pasteBehaviourGroup;
     QList<QLabel*> m_monitorProfileLabels;
     QList<SqueezedComboBox*> m_monitorProfileWidgets;
@@ -244,7 +243,6 @@ public:
  *  Display settings tab for preferences dialog
  */
 
-class KoColorPopupAction;
 
 class DisplaySettingsTab : public WdgDisplaySettings
 {
@@ -259,7 +257,6 @@ protected Q_SLOTS:
     void slotUseOpenGLToggled(bool isChecked);
 
 public:
-    KoColorPopupAction *m_selectionOverlayColorAction;
 };
 
 //=======================
diff --git a/libs/ui/forms/wdgautogradient.ui b/libs/ui/forms/wdgautogradient.ui
index e6c2ee7..cb25376 100644
--- a/libs/ui/forms/wdgautogradient.ui
+++ b/libs/ui/forms/wdgautogradient.ui
@@ -104,7 +104,7 @@
       </widget>
      </item>
      <item row="1" column="1">
-      <widget class="KColorButton" name="leftColorButton">
+      <widget class="KisColorButton" name="leftColorButton">
        <property name="sizePolicy">
         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
          <horstretch>0</horstretch>
@@ -185,7 +185,7 @@
       </widget>
      </item>
      <item row="2" column="1">
-      <widget class="KColorButton" name="rightColorButton">
+      <widget class="KisColorButton" name="rightColorButton">
        <property name="sizePolicy">
         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
          <horstretch>0</horstretch>
@@ -374,10 +374,9 @@
    <header>kis_int_parse_spin_box.h</header>
   </customwidget>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
+   <header>kis_color_button.h</header>
   </customwidget>
   <customwidget>
    <class>KisGradientSliderWidget</class>
diff --git a/libs/ui/forms/wdgcolorsettings.ui b/libs/ui/forms/wdgcolorsettings.ui
index e06a24f..c51dc04 100644
--- a/libs/ui/forms/wdgcolorsettings.ui
+++ b/libs/ui/forms/wdgcolorsettings.ui
@@ -189,13 +189,6 @@
       <string>Soft Proof Options</string>
      </property>
      <layout class="QGridLayout" name="gridLayout">
-      <item row="5" column="1">
-       <widget class="QToolButton" name="gamutAlarm">
-        <property name="text">
-         <string>...</string>
-        </property>
-       </widget>
-      </item>
       <item row="3" column="0">
        <widget class="QLabel" name="lblProofingIntent">
         <property name="text">
@@ -264,6 +257,13 @@
         </property>
        </widget>
       </item>
+      <item row="5" column="1">
+       <widget class="KisColorButton" name="gamutAlarm">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
@@ -363,6 +363,11 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KisColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_color_button.h</header>
+  </customwidget>
+  <customwidget>
    <class>KisColorSpaceSelector</class>
    <extends>QWidget</extends>
    <header>widgets/kis_color_space_selector.h</header>
@@ -378,11 +383,6 @@
    <extends>QComboBox</extends>
    <header>widgets/kis_cmb_idlist.h</header>
   </customwidget>
-  <customwidget>
-   <class>SqueezedComboBox</class>
-   <extends>QComboBox</extends>
-   <header>widgets/squeezedcombobox.h</header>
-  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
diff --git a/libs/ui/forms/wdgdisplaysettings.ui b/libs/ui/forms/wdgdisplaysettings.ui
index 0bbd7ed..deb5017 100644
--- a/libs/ui/forms/wdgdisplaysettings.ui
+++ b/libs/ui/forms/wdgdisplaysettings.ui
@@ -116,10 +116,10 @@
        </widget>
       </item>
       <item row="0" column="4">
-       <widget class="KColorButton" name="colorChecks1"/>
+       <widget class="KisColorButton" name="colorChecks1"/>
       </item>
       <item row="0" column="5">
-       <widget class="KColorButton" name="colorChecks2"/>
+       <widget class="KisColorButton" name="colorChecks2"/>
       </item>
       <item row="0" column="6">
        <spacer name="horizontalSpacer">
@@ -276,7 +276,7 @@
        </widget>
       </item>
       <item row="1" column="1">
-       <widget class="KColorButton" name="canvasBorder"/>
+       <widget class="KisColorButton" name="canvasBorder"/>
       </item>
       <item row="1" column="2">
        <spacer name="horizontalSpacer_4">
@@ -318,24 +318,21 @@
        </widget>
       </item>
       <item>
-       <widget class="QToolButton" name="btnSelectionOverlayColor">
+       <widget class="KisColorButton" name="btnSelectionOverlayColor">
         <property name="text">
-         <string>...</string>
+         <string/>
         </property>
        </widget>
       </item>
       <item>
-       <spacer name="horizontalSpacer_3">
-        <property name="orientation">
-         <enum>Qt::Horizontal</enum>
-        </property>
-        <property name="sizeHint" stdset="0">
-         <size>
-          <width>358</width>
-          <height>20</height>
-         </size>
+       <widget class="KisDoubleSliderSpinBox" name="sldSelectionOverlayOpacity" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
         </property>
-       </spacer>
+       </widget>
       </item>
      </layout>
     </widget>
@@ -349,9 +346,14 @@
    <header>kis_int_parse_spin_box.h</header>
   </customwidget>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
+   <header>kis_color_button.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KisDoubleSliderSpinBox</class>
+   <extends>QWidget</extends>
+   <header>kis_slider_spin_box.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>
diff --git a/libs/ui/forms/wdgdlginternalcolorselector.ui b/libs/ui/forms/wdgdlginternalcolorselector.ui
new file mode 100644
index 0000000..4ad1fb8
--- /dev/null
+++ b/libs/ui/forms/wdgdlginternalcolorselector.ui
@@ -0,0 +1,237 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>WdgDlgInternalColorSelector</class>
+ <widget class="QDialog" name="WdgDlgInternalColorSelector">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>505</width>
+    <height>483</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontal">
+     <item>
+      <layout class="QVBoxLayout" name="leftPane">
+       <item>
+        <widget class="KisVisualColorSelector" name="visualSelector" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>90</width>
+           <height>90</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="KisSpinboxColorSelector" name="spinboxselector" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>0</width>
+           <height>50</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QFrame" name="frame">
+         <property name="frameShape">
+          <enum>QFrame::StyledPanel</enum>
+         </property>
+         <property name="frameShadow">
+          <enum>QFrame::Sunken</enum>
+         </property>
+         <property name="lineWidth">
+          <number>2</number>
+         </property>
+         <property name="midLineWidth">
+          <number>2</number>
+         </property>
+         <layout class="QHBoxLayout" name="nextprevlayout">
+          <property name="spacing">
+           <number>0</number>
+          </property>
+          <property name="leftMargin">
+           <number>0</number>
+          </property>
+          <property name="topMargin">
+           <number>0</number>
+          </property>
+          <property name="rightMargin">
+           <number>0</number>
+          </property>
+          <property name="bottomMargin">
+           <number>0</number>
+          </property>
+          <item>
+           <widget class="KoColorPatch" name="currentColor" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="minimumSize">
+             <size>
+              <width>50</width>
+              <height>70</height>
+             </size>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="KoColorPatch" name="previousColor" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="minimumSize">
+             <size>
+              <width>25</width>
+              <height>25</height>
+             </size>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="rightPane">
+       <item>
+        <widget class="KoColorSetWidget" name="paletteBox">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>225</width>
+           <height>50</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="KisScreenColorPicker" name="screenColorPicker" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>50</width>
+           <height>50</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KisSpinboxColorSelector</class>
+   <extends>QWidget</extends>
+   <header>kis_spinbox_color_selector.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>KisScreenColorPicker</class>
+   <extends>QWidget</extends>
+   <header>kis_screen_color_picker.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>KisVisualColorSelector</class>
+   <extends>QWidget</extends>
+   <header>kis_visual_color_selector.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>KoColorPatch</class>
+   <extends>QWidget</extends>
+   <header>KoColorPatch.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>KoColorSetWidget</class>
+   <extends>QFrame</extends>
+   <header>KoColorSetWidget.h</header>
+   <container>1</container>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>WdgDlgInternalColorSelector</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>WdgDlgInternalColorSelector</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
diff --git a/libs/ui/forms/wdggeneralsettings.ui b/libs/ui/forms/wdggeneralsettings.ui
index f27eed6..aaa37d1 100644
--- a/libs/ui/forms/wdggeneralsettings.ui
+++ b/libs/ui/forms/wdggeneralsettings.ui
@@ -248,7 +248,7 @@
           </layout>
          </item>
          <item row="2" column="1">
-          <widget class="KColorButton" name="m_mdiColor">
+          <widget class="KisColorButton" name="m_mdiColor">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
              <horstretch>0</horstretch>
@@ -258,20 +258,6 @@
            <property name="text">
             <string/>
            </property>
-           <property name="color">
-            <color>
-             <red>0</red>
-             <green>0</green>
-             <blue>0</blue>
-            </color>
-           </property>
-           <property name="defaultColor">
-            <color>
-             <red>0</red>
-             <green>0</green>
-             <blue>0</blue>
-            </color>
-           </property>
           </widget>
          </item>
          <item row="1" column="0">
@@ -699,10 +685,14 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisIntParseSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>kis_int_parse_spin_box.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
+   <header>kis_color_button.h</header>
   </customwidget>
   <customwidget>
    <class>KisIntParseSpinBox</class>
diff --git a/libs/ui/forms/wdgimageproperties.ui b/libs/ui/forms/wdgimageproperties.ui
index 8a03c54..eb1196f 100644
--- a/libs/ui/forms/wdgimageproperties.ui
+++ b/libs/ui/forms/wdgimageproperties.ui
@@ -108,12 +108,19 @@
          </widget>
         </item>
         <item row="3" column="1">
-         <widget class="QToolButton" name="bnBackgroundColor">
+         <widget class="KisColorButton" name="bnBackgroundColor">
           <property name="text">
-           <string>...</string>
+           <string/>
           </property>
-          <property name="popupMode">
-           <enum>QToolButton::InstantPopup</enum>
+         </widget>
+        </item>
+        <item row="4" column="0" colspan="2">
+         <widget class="KisDoubleSliderSpinBox" name="sldBackgroundColor" native="true">
+          <property name="minimumSize">
+           <size>
+            <width>0</width>
+            <height>20</height>
+           </size>
           </property>
          </widget>
         </item>
@@ -227,13 +234,6 @@
        <string>Softproofing</string>
       </attribute>
       <layout class="QGridLayout" name="gridLayout">
-       <item row="3" column="1">
-        <widget class="QToolButton" name="gamutAlarm">
-         <property name="text">
-          <string>...</string>
-         </property>
-        </widget>
-       </item>
        <item row="3" column="0">
         <widget class="QLabel" name="lblGamutWarning">
          <property name="text">
@@ -313,6 +313,13 @@
          </layout>
         </widget>
        </item>
+       <item row="3" column="1">
+        <widget class="KisColorButton" name="gamutAlarm">
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
     </widget>
@@ -321,6 +328,17 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KisDoubleSliderSpinBox</class>
+   <extends>QWidget</extends>
+   <header>kis_slider_spin_box.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>KisColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_color_button.h</header>
+  </customwidget>
+  <customwidget>
    <class>KisColorSpaceSelector</class>
    <extends>QWidget</extends>
    <header>widgets/kis_color_space_selector.h</header>
diff --git a/libs/ui/forms/wdgnewimage.ui b/libs/ui/forms/wdgnewimage.ui
index 4d5ee82..c4841f5 100644
--- a/libs/ui/forms/wdgnewimage.ui
+++ b/libs/ui/forms/wdgnewimage.ui
@@ -507,7 +507,7 @@
         </layout>
        </item>
        <item row="2" column="2">
-        <widget class="KColorButton" name="cmbColor">
+        <widget class="KisColorButton" name="cmbColor">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
            <horstretch>0</horstretch>
@@ -645,21 +645,14 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KisColorSpaceSelector</class>
-   <extends>QWidget</extends>
-   <header>widgets/kis_color_space_selector.h</header>
-   <container>1</container>
-  </customwidget>
-  <customwidget>
-   <class>KisDoubleParseSpinBox</class>
-   <extends>QDoubleSpinBox</extends>
-   <header>kis_double_parse_spin_box.h</header>
+   <class>KisIntParseSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>kis_int_parse_spin_box.h</header>
   </customwidget>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
+   <header>kis_color_button.h</header>
   </customwidget>
   <customwidget>
    <class>KisDoubleSliderSpinBox</class>
@@ -668,9 +661,15 @@
    <container>1</container>
   </customwidget>
   <customwidget>
-   <class>KisIntParseSpinBox</class>
-   <extends>QSpinBox</extends>
-   <header>kis_int_parse_spin_box.h</header>
+   <class>KisColorSpaceSelector</class>
+   <extends>QWidget</extends>
+   <header>widgets/kis_color_space_selector.h</header>
+   <container>1</container>
+  </customwidget>
+  <customwidget>
+   <class>KisDoubleParseSpinBox</class>
+   <extends>QDoubleSpinBox</extends>
+   <header>kis_double_parse_spin_box.h</header>
   </customwidget>
  </customwidgets>
  <tabstops>
diff --git a/libs/ui/forms/wdgpaintactioneditor.ui b/libs/ui/forms/wdgpaintactioneditor.ui
index 5e82cc6..deac79f 100644
--- a/libs/ui/forms/wdgpaintactioneditor.ui
+++ b/libs/ui/forms/wdgpaintactioneditor.ui
@@ -34,19 +34,6 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="1">
-        <widget class="QToolButton" name="paintColor">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-        </widget>
-       </item>
        <item row="1" column="0">
         <widget class="QLabel" name="label_2">
          <property name="text">
@@ -57,19 +44,6 @@
          </property>
         </widget>
        </item>
-       <item row="1" column="1">
-        <widget class="QToolButton" name="backgroundColor">
-         <property name="sizePolicy">
-          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-           <horstretch>0</horstretch>
-           <verstretch>0</verstretch>
-          </sizepolicy>
-         </property>
-         <property name="text">
-          <string>...</string>
-         </property>
-        </widget>
-       </item>
        <item row="3" column="1">
         <spacer name="verticalSpacer">
          <property name="orientation">
@@ -112,6 +86,32 @@
          </property>
         </widget>
        </item>
+       <item row="0" column="1">
+        <widget class="KisColorButton" name="paintColor">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <string>...</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="KisColorButton" name="backgroundColor">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <string>...</string>
+         </property>
+        </widget>
+       </item>
       </layout>
      </widget>
      <widget class="QWidget" name="tab_2">
@@ -180,6 +180,11 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KisColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_color_button.h</header>
+  </customwidget>
+  <customwidget>
    <class>KisIntParseSpinBox</class>
    <extends>QSpinBox</extends>
    <header>kis_int_parse_spin_box.h</header>
diff --git a/libs/ui/kis_autogradient.cc b/libs/ui/kis_autogradient.cc
index 733a8ce..8786ee5 100644
--- a/libs/ui/kis_autogradient.cc
+++ b/libs/ui/kis_autogradient.cc
@@ -50,8 +50,8 @@ KisAutogradient::KisAutogradient(KoSegmentGradient* gradient, QWidget *parent, c
     connect(gradientSlider, SIGNAL(sigChangedSegment(KoGradientSegment*)), SLOT(slotChangedSegment(KoGradientSegment*)));
     connect(comboBoxColorInterpolationType, SIGNAL(activated(int)), SLOT(slotChangedColorInterpolation(int)));
     connect(comboBoxInterpolationType, SIGNAL(activated(int)), SLOT(slotChangedInterpolation(int)));
-    connect(leftColorButton, SIGNAL(changed(const QColor&)), SLOT(slotChangedLeftColor(const QColor&)));
-    connect(rightColorButton, SIGNAL(changed(const QColor&)), SLOT(slotChangedRightColor(const QColor&)));
+    connect(leftColorButton, SIGNAL(changed(const KoColor&)), SLOT(slotChangedLeftColor(const KoColor&)));
+    connect(rightColorButton, SIGNAL(changed(const KoColor&)), SLOT(slotChangedRightColor(const KoColor&)));
 
     connect(intNumInputLeftOpacity, SIGNAL(valueChanged(int)), SLOT(slotChangedLeftOpacity(int)));
     connect(intNumInputRightOpacity, SIGNAL(valueChanged(int)), SLOT(slotChangedRightOpacity(int)));
@@ -65,22 +65,17 @@ void KisAutogradient::activate()
 
 void KisAutogradient::slotSelectedSegment(KoGradientSegment* segment)
 {
-    QColor startColor;
-    QColor endColor;
 
-    segment->startColor().toQColor(&startColor);
-    segment->endColor().toQColor(&endColor);
-
-    leftColorButton->setColor(startColor);
-    rightColorButton->setColor(endColor);
+    leftColorButton->setColor(segment->startColor());
+    rightColorButton->setColor(segment->endColor());
     comboBoxColorInterpolationType->setCurrentIndex(segment->colorInterpolation());
     comboBoxInterpolationType->setCurrentIndex(segment->interpolation());
 
-    int leftOpacity = (startColor.alpha() * 100) / OPACITY_OPAQUE_U8;
+    int leftOpacity = segment->startColor().opacityF();
     intNumInputLeftOpacity->setValue(leftOpacity);
     intNumInputLeftOpacity->setSuffix(i18n(" %"));
 
-    int rightOpacity = (endColor.alpha() * 100) / OPACITY_OPAQUE_U8;
+    int rightOpacity = segment->endColor().opacityF();
     intNumInputRightOpacity->setValue(rightOpacity);
     intNumInputRightOpacity->setSuffix(i18n(" %"));
 
@@ -112,7 +107,7 @@ void KisAutogradient::slotChangedColorInterpolation(int type)
     paramChanged();
 }
 
-void KisAutogradient::slotChangedLeftColor(const QColor& color)
+void KisAutogradient::slotChangedLeftColor(const KoColor& color)
 {
     KoGradientSegment* segment = gradientSlider->selectedSegment();
     if (segment) {
@@ -125,11 +120,10 @@ void KisAutogradient::slotChangedLeftColor(const QColor& color)
     paramChanged();
 }
 
-void KisAutogradient::slotChangedRightColor(const QColor& color)
+void KisAutogradient::slotChangedRightColor(const KoColor& color)
 {
     KoGradientSegment* segment = gradientSlider->selectedSegment();
     if (segment) {
-        QColor unused;
         KoColor c(color, segment->endColor().colorSpace());
         c.setOpacity(segment->endColor().opacityU8());
         segment->setEndColor(c);
@@ -143,7 +137,7 @@ void KisAutogradient::slotChangedLeftOpacity(int value)
 {
     KoGradientSegment* segment = gradientSlider->selectedSegment();
     if (segment) {
-        KoColor c(segment->startColor().toQColor(), segment->startColor().colorSpace());
+        KoColor c(segment->startColor(), segment->startColor().colorSpace());
         c.setOpacity(qreal(value) / qreal(100.0));
         segment->setStartColor(c);
     }
@@ -156,7 +150,7 @@ void KisAutogradient::slotChangedRightOpacity(int value)
 {
     KoGradientSegment* segment = gradientSlider->selectedSegment();
     if (segment) {
-        KoColor c(segment->endColor().toQColor(), segment->endColor().colorSpace());
+        KoColor c(segment->endColor(), segment->endColor().colorSpace());
         c.setOpacity(quint8((value *OPACITY_OPAQUE_U8) / 100));
         segment->setEndColor(c);
     }
diff --git a/libs/ui/kis_autogradient.h b/libs/ui/kis_autogradient.h
index 2228fdc..0684fe7 100644
--- a/libs/ui/kis_autogradient.h
+++ b/libs/ui/kis_autogradient.h
@@ -39,8 +39,8 @@ private Q_SLOTS:
     void slotChangedSegment(KoGradientSegment* segment);
     void slotChangedInterpolation(int type);
     void slotChangedColorInterpolation(int type);
-    void slotChangedLeftColor(const QColor& color);
-    void slotChangedRightColor(const QColor& color);
+    void slotChangedLeftColor(const KoColor& color);
+    void slotChangedRightColor(const KoColor& color);
     void slotChangedLeftOpacity(int value);
     void slotChangedRightOpacity(int value);
     void slotChangedName();
diff --git a/libs/ui/kis_control_frame.cpp b/libs/ui/kis_control_frame.cpp
index e55ed00..f4c1818 100644
--- a/libs/ui/kis_control_frame.cpp
+++ b/libs/ui/kis_control_frame.cpp
@@ -46,6 +46,7 @@
 #include <KoResourceServerAdapter.h>
 #include <KoResourceServerProvider.h>
 #include <KoColorSpaceRegistry.h>
+#include <kis_image.h>
 
 #include <resources/KoPattern.h>
 #include "kis_resource_server_provider.h"
@@ -62,6 +63,7 @@
 #include "kis_favorite_resource_manager.h"
 #include "kis_display_color_converter.h"
 #include <kis_canvas2.h>
+#include <kis_image.h>
 
 
 KisControlFrame::KisControlFrame(KisViewManager *view, QWidget *parent, const char* name)
@@ -109,21 +111,22 @@ void KisControlFrame::setup(QWidget *parent)
     // XXX: KOMVC we don't have a canvas here yet, needs a setImageView
     const KoColorDisplayRendererInterface *displayRenderer = \
         KisDisplayColorConverter::dumbConverterInstance()->displayRendererInterface();
-    KoDualColorButton * dual = new KoDualColorButton(m_viewManager->resourceProvider()->fgColor(),
+    m_dual = new KoDualColorButton(m_viewManager->resourceProvider()->fgColor(),
                                                      m_viewManager->resourceProvider()->bgColor(), displayRenderer,
                                                      m_viewManager->mainWindow(), m_viewManager->mainWindow());
-    dual->setPopDialog(true);
+    m_dual->setPopDialog(true);
     action = new QWidgetAction(this);
     action->setText(i18n("&Color"));
     m_viewManager->actionCollection()->addAction("dual", action);
-    action->setDefaultWidget(dual);
-    connect(dual, SIGNAL(foregroundColorChanged(KoColor)), m_viewManager->resourceProvider(), SLOT(slotSetFGColor(KoColor)));
-    connect(dual, SIGNAL(backgroundColorChanged(KoColor)), m_viewManager->resourceProvider(), SLOT(slotSetBGColor(KoColor)));
-    connect(m_viewManager->resourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), dual, SLOT(setForegroundColor(KoColor)));
-    connect(m_viewManager->resourceProvider(), SIGNAL(sigBGColorChanged(KoColor)), dual, SLOT(setBackgroundColor(KoColor)));
+    action->setDefaultWidget(m_dual);
+    connect(m_dual, SIGNAL(foregroundColorChanged(KoColor)), m_viewManager->resourceProvider(), SLOT(slotSetFGColor(KoColor)));
+    connect(m_dual, SIGNAL(backgroundColorChanged(KoColor)), m_viewManager->resourceProvider(), SLOT(slotSetBGColor(KoColor)));
+    connect(m_viewManager->resourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), m_dual, SLOT(setForegroundColor(KoColor)));
+    connect(m_viewManager->resourceProvider(), SIGNAL(sigBGColorChanged(KoColor)), m_dual, SLOT(setBackgroundColor(KoColor)));
     connect(m_viewManager->resourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), m_gradientWidget, SLOT(update()));
     connect(m_viewManager->resourceProvider(), SIGNAL(sigBGColorChanged(KoColor)), m_gradientWidget, SLOT(update()));
-    dual->setFixedSize(28, 28);
+    m_dual->setFixedSize(28, 28);
+    connect(m_viewManager, SIGNAL(viewChanged()), SLOT(slotUpdateDisplayRenderer()));
 
     m_paintopBox = new KisPaintopBox(m_viewManager, parent, "paintopbox");
 
@@ -133,6 +136,18 @@ void KisControlFrame::setup(QWidget *parent)
     action->setDefaultWidget(m_paintopBox);
 }
 
+void KisControlFrame::slotUpdateDisplayRenderer()
+{
+    if (m_viewManager->canvasBase()){
+        m_dual->setDisplayRenderer(m_viewManager->canvasBase()->displayColorConverter()->displayRendererInterface());
+        m_dual->setColorSpace(m_viewManager->canvasBase()->image()->colorSpace());
+        m_viewManager->canvasBase()->image()->disconnect(m_dual);
+        connect(m_viewManager->canvasBase()->image(), SIGNAL(sigColorSpaceChanged(const KoColorSpace*)), m_dual, SLOT(setColorSpace(const KoColorSpace*)), Qt::UniqueConnection);
+    } else if (m_viewManager->viewCount()==0) {
+        m_dual->setDisplayRenderer();
+    }
+}
+
 void KisControlFrame::slotSetPattern(KoPattern * pattern)
 {
     m_patternWidget->slotSetItem(pattern);
diff --git a/libs/ui/kis_control_frame.h b/libs/ui/kis_control_frame.h
index dea70f7..f07c724 100644
--- a/libs/ui/kis_control_frame.h
+++ b/libs/ui/kis_control_frame.h
@@ -37,6 +37,7 @@ class KisPaintopBox;
 class KisViewManager;
 class KisIconWidget;
 class KoPattern;
+class KoDualColorButton;
 
 /**
  *   Control Frame - status display with access to
@@ -60,6 +61,7 @@ private Q_SLOTS:
 
     void slotSetPattern(KoPattern * pattern);
     void slotSetGradient(KoAbstractGradient * gradient);
+    void slotUpdateDisplayRenderer();
 
 private:
 
@@ -85,6 +87,8 @@ private:
 
     KisPaintopBox *m_paintopBox;
 
+    KoDualColorButton *m_dual;
+
 };
 
 #endif
diff --git a/libs/ui/kis_custom_pattern.cc b/libs/ui/kis_custom_pattern.cc
index 2ff6689..dc0e15a 100644
--- a/libs/ui/kis_custom_pattern.cc
+++ b/libs/ui/kis_custom_pattern.cc
@@ -36,6 +36,8 @@
 #include "kis_image.h"
 #include "kis_layer.h"
 #include "kis_paint_device.h"
+#include "kis_selection.h"
+#include "kis_painter.h"
 
 #include <kis_debug.h>
 #include "kis_resource_server_provider.h"
@@ -139,6 +141,7 @@ void KisCustomPattern::createPattern()
     if (!m_view) return;
 
     KisPaintDeviceSP dev;
+    KisPaintDeviceSP cache;
     QString name;
     KisImageWSP image = m_view->image();
     if (!image) return;
@@ -157,6 +160,21 @@ void KisCustomPattern::createPattern()
         name = image->objectName();
     }
     if (!dev) return;
+
+    if(m_view->selection()) {
+        KisSelectionSP selection = m_view->selection();
+        QRect selectionRect = selection->selectedExactRect();
+        cache = dev->createCompositionSourceDevice();
+        KisPainter gc(cache);
+        gc.setSelection(selection);
+        gc.bitBlt(selectionRect.topLeft(), dev, selectionRect);
+        rc = selectionRect;
+    } else {
+        cache = dev;
+    }
+    if (!cache) return;
+
+
     // warn when creating large patterns
 
     QSize size = rc.size();
@@ -167,7 +185,7 @@ void KisCustomPattern::createPattern()
     }
 
     QString dir = KoResourceServerProvider::instance()->patternServer()->saveLocation();
-    m_pattern = new KoPattern(dev->createThumbnail(size.width(), size.height(), rc, /*oversample*/ 1,
+    m_pattern = new KoPattern(cache->createThumbnail(size.width(), size.height(), rc, /*oversample*/ 1,
                                                     KoColorConversionTransformation::internalRenderingIntent(),
                                                     KoColorConversionTransformation::internalConversionFlags()), name, dir);
 }
diff --git a/libs/ui/kis_popup_palette.cpp b/libs/ui/kis_popup_palette.cpp
index e7c8988..98db88b 100644
--- a/libs/ui/kis_popup_palette.cpp
+++ b/libs/ui/kis_popup_palette.cpp
@@ -26,6 +26,8 @@
 #include <brushengine/kis_paintop_preset.h>
 #include "kis_resource_server_provider.h"
 #include <KoTriangleColorSelector.h>
+#include <kis_visual_color_selector.h>
+#include <kis_config_notifier.h>
 #include "KoColorSpaceRegistry.h"
 #include <kis_types.h>
 #include <QtGui>
@@ -106,21 +108,27 @@ KisPopupPalette::KisPopupPalette(KisFavoriteResourceManager* manager, const KoCo
 {
 
     const int borderWidth = 3;
-    m_triangleColorSelector  = new PopupColorTriangle(displayRenderer, this);
+    //m_triangleColorSelector  = new PopupColorTriangle(displayRenderer, this);
+    m_triangleColorSelector = new KisVisualColorSelector(this);
+    m_triangleColorSelector->setDisplayRenderer(displayRenderer);
+    m_triangleColorSelector->setConfig(true,false);
     m_triangleColorSelector->move(widgetSize/2-colorInnerRadius+borderWidth, widgetSize/2-colorInnerRadius+borderWidth);
     m_triangleColorSelector->resize(colorInnerRadius*2-borderWidth*2, colorInnerRadius*2-borderWidth*2);
     m_triangleColorSelector->setVisible(true);
+    m_triangleColorSelector->slotSetColor(KoColor());
 
     QRegion maskedRegion(0, 0, m_triangleColorSelector->width(), m_triangleColorSelector->height(), QRegion::Ellipse );
     m_triangleColorSelector->setMask(maskedRegion);
 
     //setAttribute(Qt::WA_TranslucentBackground, true);
 
-    connect(m_triangleColorSelector, SIGNAL(realColorChanged(KoColor)),
+    connect(m_triangleColorSelector, SIGNAL(sigNewColor(KoColor)),
             m_colorChangeCompressor.data(), SLOT(start()));
     connect(m_colorChangeCompressor.data(), SIGNAL(timeout()),
             SLOT(slotEmitColorChanged()));
 
+    connect(KisConfigNotifier::instance(), SIGNAL(configChanged()), m_triangleColorSelector, SLOT(ConfigurationChanged()));
+
     connect(m_resourceManager, SIGNAL(sigChangeFGColorSelector(KoColor)),
             SLOT(slotExternalFgColorChanged(KoColor)));
     connect(this, SIGNAL(sigChangefGColor(KoColor)),
@@ -179,14 +187,23 @@ KisPopupPalette::KisPopupPalette(KisFavoriteResourceManager* manager, const KoCo
 
 void KisPopupPalette::slotExternalFgColorChanged(const KoColor &color)
 {
-    m_triangleColorSelector->setRealColor(color);
+    //m_triangleColorSelector->setRealColor(color);
+    //hack to get around cmyk for now.
+    if (color.colorSpace()->colorChannelCount()>3) {
+        KoColor c(KoColorSpaceRegistry::instance()->rgb8());
+        c.fromKoColor(color);
+        m_triangleColorSelector->slotSetColor(c);
+    } else {
+        m_triangleColorSelector->slotSetColor(color);
+    }
+
 }
 
 void KisPopupPalette::slotEmitColorChanged()
 {
     if (isVisible()) {
         update();
-        emit sigChangefGColor(m_triangleColorSelector->realColor());
+        emit sigChangefGColor(m_triangleColorSelector->getCurrentColor());
     }
 }
 
@@ -325,7 +342,7 @@ void KisPopupPalette::paintEvent(QPaintEvent* e)
     //painting foreground color
     QPainterPath fgColor;
     fgColor.addEllipse(QPoint(-width() / 2 + 50, -height() / 2 + 32), 30, 30);
-    painter.fillPath(fgColor, m_displayRenderer->toQColor(m_triangleColorSelector->realColor()));
+    painter.fillPath(fgColor, m_displayRenderer->toQColor(m_triangleColorSelector->getCurrentColor()));
     painter.drawPath(fgColor);
 
     // create an ellipse for the background that is slightly
diff --git a/libs/ui/kis_popup_palette.h b/libs/ui/kis_popup_palette.h
index 0c6f73f..a45e375 100644
--- a/libs/ui/kis_popup_palette.h
+++ b/libs/ui/kis_popup_palette.h
@@ -33,6 +33,7 @@ class KisSignalCompressor;
 class KisBrushHud;
 class KisRoundHudButton;
 class KisCanvasResourceProvider;
+class KisVisualColorSelector;
 
 class KisPopupPalette : public QWidget
 {
@@ -98,7 +99,7 @@ private:
     int m_hoveredColor;
     int m_selectedColor;
     KisFavoriteResourceManager* m_resourceManager;
-    KoTriangleColorSelector* m_triangleColorSelector;
+    KisVisualColorSelector* m_triangleColorSelector;
 
     QTimer* m_timer;
 
diff --git a/libs/ui/layerstyles/WdgColorOverlay.ui b/libs/ui/layerstyles/WdgColorOverlay.ui
index cc49103..8c71bf7 100644
--- a/libs/ui/layerstyles/WdgColorOverlay.ui
+++ b/libs/ui/layerstyles/WdgColorOverlay.ui
@@ -52,7 +52,7 @@
             </widget>
            </item>
            <item>
-            <widget class="KColorButton" name="bnColor">
+            <widget class="KisColorButton" name="bnColor">
              <property name="text">
               <string>...</string>
              </property>
@@ -115,15 +115,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
-  </customwidget>
-  <customwidget>
-   <class>KisCompositeOpComboBox</class>
-   <extends>QComboBox</extends>
-   <header location="global">kis_cmb_composite.h</header>
+   <header>kis_color_button.h</header>
   </customwidget>
   <customwidget>
    <class>KisSliderSpinBox</class>
@@ -131,6 +125,11 @@
    <header location="global">kis_slider_spin_box.h</header>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>KisCompositeOpComboBox</class>
+   <extends>QComboBox</extends>
+   <header location="global">kis_cmb_composite.h</header>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
diff --git a/libs/ui/layerstyles/WdgSatin.ui b/libs/ui/layerstyles/WdgSatin.ui
index d40f0c8..31d2567 100644
--- a/libs/ui/layerstyles/WdgSatin.ui
+++ b/libs/ui/layerstyles/WdgSatin.ui
@@ -49,7 +49,7 @@
             </widget>
            </item>
            <item>
-            <widget class="KColorButton" name="bnColor">
+            <widget class="KisColorButton" name="bnColor">
              <property name="text">
               <string>...</string>
              </property>
@@ -247,6 +247,11 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KisColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_color_button.h</header>
+  </customwidget>
+  <customwidget>
    <class>KisIntParseSpinBox</class>
    <extends>QSpinBox</extends>
    <header>kis_int_parse_spin_box.h</header>
@@ -258,12 +263,6 @@
    <container>1</container>
   </customwidget>
   <customwidget>
-   <class>KColorButton</class>
-   <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
-  </customwidget>
-  <customwidget>
    <class>KisCompositeOpComboBox</class>
    <extends>QComboBox</extends>
    <header location="global">kis_cmb_composite.h</header>
diff --git a/libs/ui/layerstyles/WdgStroke.ui b/libs/ui/layerstyles/WdgStroke.ui
index 513eff7..bc7a553 100644
--- a/libs/ui/layerstyles/WdgStroke.ui
+++ b/libs/ui/layerstyles/WdgStroke.ui
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>401</width>
+    <width>406</width>
     <height>642</height>
    </rect>
   </property>
@@ -149,7 +149,7 @@
          <item>
           <widget class="QStackedWidget" name="fillStack">
            <property name="currentIndex">
-            <number>1</number>
+            <number>0</number>
            </property>
            <widget class="QWidget" name="page_3">
             <layout class="QFormLayout" name="formLayout_2">
@@ -161,7 +161,7 @@
               </widget>
              </item>
              <item row="0" column="1">
-              <widget class="KColorButton" name="bnColor">
+              <widget class="KisColorButton" name="bnColor">
                <property name="text">
                 <string>...</string>
                </property>
@@ -403,15 +403,14 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
+   <header>kis_color_button.h</header>
   </customwidget>
   <customwidget>
-   <class>KisCompositeOpComboBox</class>
-   <extends>QComboBox</extends>
-   <header location="global">kis_cmb_composite.h</header>
+   <class>KisIntParseSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>kis_int_parse_spin_box.h</header>
   </customwidget>
   <customwidget>
    <class>KisSliderSpinBox</class>
@@ -420,6 +419,11 @@
    <container>1</container>
   </customwidget>
   <customwidget>
+   <class>KisCompositeOpComboBox</class>
+   <extends>QComboBox</extends>
+   <header location="global">kis_cmb_composite.h</header>
+  </customwidget>
+  <customwidget>
    <class>KisCmbGradient</class>
    <extends>QToolButton</extends>
    <header>kis_cmb_gradient.h</header>
@@ -430,11 +434,6 @@
    <header location="global">kis_pattern_chooser.h</header>
    <container>1</container>
   </customwidget>
-  <customwidget>
-   <class>KisIntParseSpinBox</class>
-   <extends>QSpinBox</extends>
-   <header>kis_int_parse_spin_box.h</header>
-  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
diff --git a/libs/ui/layerstyles/wdgBevelAndEmboss.ui b/libs/ui/layerstyles/wdgBevelAndEmboss.ui
index 1f918c0..1bd4462 100644
--- a/libs/ui/layerstyles/wdgBevelAndEmboss.ui
+++ b/libs/ui/layerstyles/wdgBevelAndEmboss.ui
@@ -313,7 +313,7 @@
             </widget>
            </item>
            <item>
-            <widget class="KColorButton" name="bnHighlightColor">
+            <widget class="KisColorButton" name="bnHighlightColor">
              <property name="text">
               <string>...</string>
              </property>
@@ -366,7 +366,7 @@
             </widget>
            </item>
            <item>
-            <widget class="KColorButton" name="bnShadowColor">
+            <widget class="KisColorButton" name="bnShadowColor">
              <property name="text">
               <string>...</string>
              </property>
@@ -455,6 +455,11 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KisColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_color_button.h</header>
+  </customwidget>
+  <customwidget>
    <class>KisIntParseSpinBox</class>
    <extends>QSpinBox</extends>
    <header>kis_int_parse_spin_box.h</header>
@@ -466,12 +471,6 @@
    <container>1</container>
   </customwidget>
   <customwidget>
-   <class>KColorButton</class>
-   <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
-  </customwidget>
-  <customwidget>
    <class>KisCompositeOpComboBox</class>
    <extends>QComboBox</extends>
    <header location="global">kis_cmb_composite.h</header>
diff --git a/libs/ui/layerstyles/wdgInnerGlow.ui b/libs/ui/layerstyles/wdgInnerGlow.ui
index fcf6601..ce23fc6 100644
--- a/libs/ui/layerstyles/wdgInnerGlow.ui
+++ b/libs/ui/layerstyles/wdgInnerGlow.ui
@@ -120,7 +120,7 @@
             </widget>
            </item>
            <item>
-            <widget class="KColorButton" name="bnColor">
+            <widget class="KisColorButton" name="bnColor">
              <property name="text">
               <string>...</string>
              </property>
@@ -374,15 +374,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
-  </customwidget>
-  <customwidget>
-   <class>KisCompositeOpComboBox</class>
-   <extends>QComboBox</extends>
-   <header location="global">kis_cmb_composite.h</header>
+   <header>kis_color_button.h</header>
   </customwidget>
   <customwidget>
    <class>KisSliderSpinBox</class>
@@ -391,6 +385,11 @@
    <container>1</container>
   </customwidget>
   <customwidget>
+   <class>KisCompositeOpComboBox</class>
+   <extends>QComboBox</extends>
+   <header location="global">kis_cmb_composite.h</header>
+  </customwidget>
+  <customwidget>
    <class>KisCmbContour</class>
    <extends>QWidget</extends>
    <header>kis_cmb_contour.h</header>
diff --git a/libs/ui/layerstyles/wdgdropshadow.ui b/libs/ui/layerstyles/wdgdropshadow.ui
index d1f81dc..3074d05 100644
--- a/libs/ui/layerstyles/wdgdropshadow.ui
+++ b/libs/ui/layerstyles/wdgdropshadow.ui
@@ -120,7 +120,7 @@
           </widget>
          </item>
          <item row="0" column="2">
-          <widget class="KColorButton" name="bnColor"/>
+          <widget class="KisColorButton" name="bnColor"/>
          </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_14">
@@ -287,6 +287,11 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KisColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_color_button.h</header>
+  </customwidget>
+  <customwidget>
    <class>KisIntParseSpinBox</class>
    <extends>QSpinBox</extends>
    <header>kis_int_parse_spin_box.h</header>
@@ -298,12 +303,6 @@
    <container>1</container>
   </customwidget>
   <customwidget>
-   <class>KColorButton</class>
-   <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
-  </customwidget>
-  <customwidget>
    <class>KisCompositeOpComboBox</class>
    <extends>QComboBox</extends>
    <header location="global">kis_cmb_composite.h</header>
diff --git a/libs/ui/recorder/kis_recorded_paint_action_editor.cc b/libs/ui/recorder/kis_recorded_paint_action_editor.cc
index 00816b3..f9e29ff 100644
--- a/libs/ui/recorder/kis_recorded_paint_action_editor.cc
+++ b/libs/ui/recorder/kis_recorded_paint_action_editor.cc
@@ -22,8 +22,6 @@
 #include <QGridLayout>
 
 #include <KoColor.h>
-#include <KoColorPopupAction.h>
-
 
 #include "recorder/kis_recorded_paint_action.h"
 #include <brushengine/kis_paintop_preset.h>
@@ -45,17 +43,13 @@ KisRecordedPaintActionEditor::KisRecordedPaintActionEditor(QWidget* parent, KisR
     m_actionEditor->setupUi(this);
 
     // Setup paint color editor
-    m_paintColorPopup = new KoColorPopupAction(this);
-    m_paintColorPopup->setCurrentColor(m_action->paintColor());
-    m_actionEditor->paintColor->setDefaultAction(m_paintColorPopup);
-    connect(m_paintColorPopup, SIGNAL(colorChanged(const KoColor &)),
+    m_actionEditor->paintColor->setColor(m_action->paintColor());
+    connect(m_actionEditor->paintColor, SIGNAL(changed(KoColor)),
             this, SLOT(configurationUpdated()));
 
     // Setup background color editor
-    m_backgroundColorPopup = new KoColorPopupAction(this);
-    m_backgroundColorPopup->setCurrentColor(m_action->backgroundColor());
-    m_actionEditor->backgroundColor->setDefaultAction(m_backgroundColorPopup);
-    connect(m_backgroundColorPopup, SIGNAL(colorChanged(const KoColor &)),
+    m_actionEditor->backgroundColor->setColor(m_action->backgroundColor());
+    connect(m_actionEditor->backgroundColor, SIGNAL(changed(KoColor)),
             this, SLOT(configurationUpdated()));
 
     // Setup opacity
@@ -107,8 +101,8 @@ void KisRecordedPaintActionEditor::configurationUpdated()
 {
     m_configWidget->writeConfigurationSafe(const_cast<KisPaintOpSettings*>(m_action->paintOpPreset()->settings().data()));
 
-    m_action->setPaintColor(m_paintColorPopup->currentKoColor());
-    m_action->setBackgroundColor(m_backgroundColorPopup->currentKoColor());
+    m_action->setPaintColor(m_actionEditor->paintColor->color());
+    m_action->setBackgroundColor(m_actionEditor->backgroundColor->color());
     m_action->setOpacity(m_actionEditor->opacity->value() / qreal(100.0));
 
     emit(actionEdited());
diff --git a/libs/ui/recorder/kis_recorded_paint_action_editor.h b/libs/ui/recorder/kis_recorded_paint_action_editor.h
index 2b55c27..50f907a 100644
--- a/libs/ui/recorder/kis_recorded_paint_action_editor.h
+++ b/libs/ui/recorder/kis_recorded_paint_action_editor.h
@@ -51,8 +51,6 @@ private:
     KisRecordedPaintAction* m_action;
     Ui_WdgPaintActionEditor* m_actionEditor;
     KisPaintOpConfigWidget* m_configWidget;
-    KoColorPopupAction* m_paintColorPopup;
-    KoColorPopupAction* m_backgroundColorPopup;
     QGridLayout* m_gridLayout;
     QList<QString> m_paintops;
     QMap<QString, KisPaintOpPresetSP> m_paintOpsToPreset;
diff --git a/libs/widgets/KoDualColorButton.cpp b/libs/ui/widgets/KoDualColorButton.cpp
similarity index 76%
rename from libs/widgets/KoDualColorButton.cpp
rename to libs/ui/widgets/KoDualColorButton.cpp
index 9913419..ad7fb11 100644
--- a/libs/widgets/KoDualColorButton.cpp
+++ b/libs/ui/widgets/KoDualColorButton.cpp
@@ -25,6 +25,7 @@
 #include "dcolorreset.xpm"
 
 #include <QColorDialog>
+#include "dialogs/kis_dlg_internal_color_selector.h"
 
 #include <QBrush>
 #include <QDrag>
@@ -80,6 +81,7 @@ class Q_DECL_HIDDEN KoDualColorButton::Private
     bool dragFlag, miniCtlFlag;
     KoColor foregroundColor;
     KoColor backgroundColor;
+    KisDlgInternalColorSelector *colorSelectorDialog;
     QPoint dragPosition;
     Selection tmpSelection;
     bool popDialog;
@@ -94,6 +96,12 @@ void KoDualColorButton::Private::init(KoDualColorButton *q)
         q->setMinimumSize( q->sizeHint() );
 
     q->setAcceptDrops( true );
+    QString caption = i18n("Select a color");
+    KisDlgInternalColorSelector::Config config = KisDlgInternalColorSelector::Config();
+    config.modal = false;
+    colorSelectorDialog = new KisDlgInternalColorSelector(q, foregroundColor, config, caption, displayRenderer);
+    connect(colorSelectorDialog, SIGNAL(signalForegroundColorChosen(KoColor)), q, SLOT(slotSetForeGroundColorFromDialog(KoColor)));
+    connect(q, SIGNAL(foregroundColorChanged(KoColor)), colorSelectorDialog, SLOT(slotColorUpdated(KoColor)));
 }
 
 KoDualColorButton::KoDualColorButton(const KoColor &foregroundColor, const KoColor &backgroundColor, QWidget *parent, QWidget* dialogParent )
@@ -144,6 +152,7 @@ QSize KoDualColorButton::sizeHint() const
 void KoDualColorButton::setForegroundColor( const KoColor &color )
 {
   d->foregroundColor = color;
+  d->colorSelectorDialog->slotColorUpdated(color);
   repaint();
 }
 
@@ -153,6 +162,34 @@ void KoDualColorButton::setBackgroundColor( const KoColor &color )
   repaint();
 }
 
+void KoDualColorButton::setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer)
+{
+    if (displayRenderer) {
+        d->displayRenderer = displayRenderer;
+        d->colorSelectorDialog->setDisplayRenderer(displayRenderer);
+        connect(d->displayRenderer, SIGNAL(destroyed()), this, SLOT(setDisplayRenderer()), Qt::UniqueConnection);
+    } else {
+        d->displayRenderer = KoDumbColorDisplayRenderer::instance();
+    }
+}
+
+void KoDualColorButton::setColorSpace(const KoColorSpace *cs)
+{
+    d->colorSelectorDialog->lockUsedColorSpace(cs);
+}
+
+QColor KoDualColorButton::getColorFromDisplayRenderer(KoColor c)
+{
+    QColor col;
+    if (d->displayRenderer) {
+        c.convertTo(d->displayRenderer->getPaintingColorSpace());
+        col = d->displayRenderer->toQColor(c);
+    } else {
+        col = c.toQColor();
+    }
+    return col;
+}
+
 void KoDualColorButton::setPopDialog( bool popDialog )
 {
   d->popDialog = popDialog;
@@ -174,8 +211,8 @@ void KoDualColorButton::paintEvent(QPaintEvent *)
   metrics( foregroundRect, backgroundRect );
 
   QBrush defBrush = palette().brush( QPalette::Button );
-  QBrush foregroundBrush( d->displayRenderer->toQColor(d->foregroundColor), Qt::SolidPattern );
-  QBrush backgroundBrush( d->displayRenderer->toQColor(d->backgroundColor), Qt::SolidPattern );
+  QBrush foregroundBrush( getColorFromDisplayRenderer(d->foregroundColor), Qt::SolidPattern );
+  QBrush backgroundBrush( getColorFromDisplayRenderer(d->backgroundColor), Qt::SolidPattern );
 
   qDrawShadeRect( &painter, backgroundRect, palette(), false, 1, 0,
                   isEnabled() ? &backgroundBrush : &defBrush );
@@ -213,6 +250,13 @@ void KoDualColorButton::dropEvent( QDropEvent *event )
 */
 }
 
+void KoDualColorButton::slotSetForeGroundColorFromDialog(const KoColor color)
+{
+    d->foregroundColor = color;
+    repaint();
+    emit foregroundColorChanged(d->foregroundColor);
+}
+
 void KoDualColorButton::mousePressEvent( QMouseEvent *event )
 {
   QRect foregroundRect;
@@ -263,8 +307,8 @@ void KoDualColorButton::mouseMoveEvent( QMouseEvent *event )
     if ( event->x() >= d->dragPosition.x() + delay || event->x() <= d->dragPosition.x() - delay ||
          event->y() >= d->dragPosition.y() + delay || event->y() <= d->dragPosition.y() - delay ) {
       KColorMimeData::createDrag( d->tmpSelection == Foreground ?
-                                  d->displayRenderer->toQColor(d->foregroundColor) :
-                                  d->displayRenderer->toQColor(d->backgroundColor),
+                                  getColorFromDisplayRenderer(d->foregroundColor) :
+                                  getColorFromDisplayRenderer(d->backgroundColor),
                                   this )->start();
       d->dragFlag = true;
     }
@@ -287,12 +331,15 @@ void KoDualColorButton::mouseReleaseEvent( QMouseEvent *event )
     if ( foregroundRect.contains( event->pos() )) {
         if(d->tmpSelection == Foreground ) {
             if( d->popDialog) {
-                QColor c = d->displayRenderer->toQColor(d->foregroundColor);
-                c = QColorDialog::getColor(c, this) ;
-                if (c.isValid()) {
-                    d->foregroundColor = d->displayRenderer->approximateFromRenderedQColor(c);
-                    emit foregroundColorChanged(d->foregroundColor);
-                }
+                d->colorSelectorDialog->show();
+
+                //QColor c = d->displayRenderer->toQColor(d->foregroundColor);
+                //c = QColorDialog::getColor(c, this) ;
+
+                //if (c.isValid()) {
+                //    d->foregroundColor = d->displayRenderer->approximateFromRenderedQColor(c);
+                //    emit foregroundColorChanged(d->foregroundColor);
+                //}
             }
             else
                 emit pleasePopDialog( d->foregroundColor);
@@ -304,12 +351,16 @@ void KoDualColorButton::mouseReleaseEvent( QMouseEvent *event )
     } else if ( backgroundRect.contains( event->pos() )) {
         if(d->tmpSelection == Background ) {
             if( d->popDialog) {
-                QColor c = d->displayRenderer->toQColor(d->backgroundColor);
+                KoColor c = d->backgroundColor;
+                c = KisDlgInternalColorSelector::getModalColorDialog(c, this);
+                d->backgroundColor = c;
+                emit backgroundColorChanged(d->backgroundColor);
+                /*QColor c = d->displayRenderer->toQColor(d->backgroundColor);
                 c = QColorDialog::getColor(c, this);
                 if (c.isValid()) {
                     d->backgroundColor = d->displayRenderer->approximateFromRenderedQColor(c);
                     emit backgroundColorChanged(d->backgroundColor);
-                }
+                }*/
             }
             else
                 emit pleasePopDialog( d->backgroundColor);
diff --git a/libs/widgets/KoDualColorButton.h b/libs/ui/widgets/KoDualColorButton.h
similarity index 87%
rename from libs/widgets/KoDualColorButton.h
rename to libs/ui/widgets/KoDualColorButton.h
index be53059..dada703 100644
--- a/libs/widgets/KoDualColorButton.h
+++ b/libs/ui/widgets/KoDualColorButton.h
@@ -22,12 +22,11 @@
 #define KODUALCOLORBUTTON_H
 
 #include "kritawidgets_export.h"
-
+#include <KoColorDisplayRendererInterface.h>
 #include <QWidget>
 
 class KoColor;
-class KoColorDisplayRendererInterface;
-
+class KoColorSpace;
 /**
  * @short A widget for selecting two related colors.
  *
@@ -115,6 +114,26 @@ class KRITAWIDGETS_EXPORT KoDualColorButton : public QWidget
      */
     void setBackgroundColor( const KoColor &color );
 
+    void slotSetForeGroundColorFromDialog (const KoColor color);
+
+    void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
+
+    /**
+     * @brief setColorSpace
+     * set ColorSpace so we can lock the selector. Right now this'll be changed per view-change.
+     * @param cs
+     */
+    void setColorSpace(const KoColorSpace *cs);
+
+    /**
+     * @brief getColorFromDisplayRenderer
+     * convenience function to get the right qcolor from the display renderer, including checking
+     * whether the display renderer actually exists.
+     * @param c the kocolor to convert.
+     * @return the qcolor to use for display.
+     */
+    QColor getColorFromDisplayRenderer(KoColor c);
+
     /**
      * Sets if a dialog with a color chooser should be popped up when clicking
      * If you set this to false then you could connect to the pleasePopDialog signal
diff --git a/libs/ui/widgets/kis_color_button.cpp b/libs/ui/widgets/kis_color_button.cpp
new file mode 100644
index 0000000..d6b0777
--- /dev/null
+++ b/libs/ui/widgets/kis_color_button.cpp
@@ -0,0 +1,340 @@
+/*  This file is part of the KDE libraries
+    Copyright (C) 1997 Martin Jones (mjones at kde.org)
+    Copyright (C) 1999 Cristian Tibirna (ctibirna at kde.org)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "kis_color_button.h"
+
+#include <QtCore/QPointer>
+#include <QPainter>
+#include <qdrawutil.h>
+#include <QApplication>
+#include <QColorDialog>
+#include <QClipboard>
+#include <QMimeData>
+#include <QDrag>
+#include <QStyle>
+#include <QMouseEvent>
+#include <QStyleOptionButton>
+
+#include <KoColor.h>
+#include <dialogs/kis_dlg_internal_color_selector.h>
+
+class KisColorButton::KisColorButtonPrivate
+{
+public:
+    KisColorButtonPrivate(KisColorButton *q);
+
+    void _k_chooseColor();
+    void _k_colorChosen();
+
+    KisColorButton *q;
+    KoColor m_defaultColor;
+    bool m_bdefaultColor : 1;
+    bool m_alphaChannel : 1;
+
+    KoColor col;
+    QPoint mPos;
+
+    QPointer<KisDlgInternalColorSelector> dialogPtr;
+
+    void initStyleOption(QStyleOptionButton *opt) const;
+};
+
+/////////////////////////////////////////////////////////////////////
+// Functions duplicated from KColorMimeData
+// Should be kept in sync
+void _k_populateMimeData(QMimeData *mimeData, const KoColor &color)
+{
+    mimeData->setColorData(color.toQColor());
+    mimeData->setText(color.toQColor().name());
+}
+
+bool _k_canDecode(const QMimeData *mimeData)
+{
+    if (mimeData->hasColor()) {
+        return true;
+    }
+    if (mimeData->hasText()) {
+        const QString colorName = mimeData->text();
+        if ((colorName.length() >= 4) && (colorName[0] == QLatin1Char('#'))) {
+            return true;
+        }
+    }
+    return false;
+}
+
+QColor _k_fromMimeData(const QMimeData *mimeData)
+{
+    if (mimeData->hasColor()) {
+        return mimeData->colorData().value<QColor>();
+    }
+    if (_k_canDecode(mimeData)) {
+        return QColor(mimeData->text());
+    }
+    return QColor();
+}
+
+QDrag *_k_createDrag(const KoColor &color, QObject *dragsource)
+{
+    QDrag *drag = new QDrag(dragsource);
+    QMimeData *mime = new QMimeData;
+    _k_populateMimeData(mime, color);
+    drag->setMimeData(mime);
+    QPixmap colorpix(25, 20);
+    colorpix.fill(color.toQColor());
+    QPainter p(&colorpix);
+    p.setPen(Qt::black);
+    p.drawRect(0, 0, 24, 19);
+    p.end();
+    drag->setPixmap(colorpix);
+    drag->setHotSpot(QPoint(-5, -7));
+    return drag;
+}
+/////////////////////////////////////////////////////////////////////
+
+KisColorButton::KisColorButtonPrivate::KisColorButtonPrivate(KisColorButton *q)
+    : q(q)
+{
+    m_bdefaultColor = false;
+    m_alphaChannel = false;
+    q->setAcceptDrops(true);
+
+    connect(q, SIGNAL(clicked()), q, SLOT(_k_chooseColor()));
+}
+
+KisColorButton::KisColorButton(QWidget *parent)
+    : QPushButton(parent)
+    , d(new KisColorButtonPrivate(this))
+{
+}
+
+KisColorButton::KisColorButton(const KoColor &c, QWidget *parent)
+    : QPushButton(parent)
+    , d(new KisColorButtonPrivate(this))
+{
+    d->col = c;
+}
+
+KisColorButton::KisColorButton(const KoColor &c, const KoColor &defaultColor, QWidget *parent)
+    : QPushButton(parent)
+    , d(new KisColorButtonPrivate(this))
+{
+    d->col = c;
+    setDefaultColor(defaultColor);
+}
+
+KisColorButton::~KisColorButton()
+{
+    delete d;
+}
+
+KoColor KisColorButton::color() const
+{
+    return d->col;
+}
+
+void KisColorButton::setColor(const KoColor &c)
+{
+    d->col = c;
+    update();
+    emit changed(d->col);
+}
+
+void KisColorButton::setAlphaChannelEnabled(bool alpha)
+{
+    d->m_alphaChannel = alpha;
+}
+
+bool KisColorButton::isAlphaChannelEnabled() const
+{
+    return d->m_alphaChannel;
+}
+
+KoColor KisColorButton::defaultColor() const
+{
+    return d->m_defaultColor;
+}
+
+void KisColorButton::setDefaultColor(const KoColor &c)
+{
+    d->m_bdefaultColor = true;
+    d->m_defaultColor = c;
+}
+
+void KisColorButton::KisColorButtonPrivate::initStyleOption(QStyleOptionButton *opt) const
+{
+    opt->initFrom(q);
+    opt->state |= q->isDown() ? QStyle::State_Sunken : QStyle::State_Raised;
+    opt->features = QStyleOptionButton::None;
+    if (q->isDefault()) {
+        opt->features |= QStyleOptionButton::DefaultButton;
+    }
+    opt->text.clear();
+    opt->icon = QIcon();
+}
+
+void KisColorButton::paintEvent(QPaintEvent *)
+{
+    QPainter painter(this);
+    QStyle *style = QWidget::style();
+
+    //First, we need to draw the bevel.
+    QStyleOptionButton butOpt;
+    d->initStyleOption(&butOpt);
+    style->drawControl(QStyle::CE_PushButtonBevel, &butOpt, &painter, this);
+
+    //OK, now we can muck around with drawing out pretty little color box
+    //First, sort out where it goes
+    QRect labelRect = style->subElementRect(QStyle::SE_PushButtonContents,
+                                            &butOpt, this);
+    int shift = style->pixelMetric(QStyle::PM_ButtonMargin, &butOpt, this) / 2;
+    labelRect.adjust(shift, shift, -shift, -shift);
+    int x, y, w, h;
+    labelRect.getRect(&x, &y, &w, &h);
+
+    if (isChecked() || isDown()) {
+        x += style->pixelMetric(QStyle::PM_ButtonShiftHorizontal, &butOpt, this);
+        y += style->pixelMetric(QStyle::PM_ButtonShiftVertical, &butOpt, this);
+    }
+
+    QColor fillCol = isEnabled() ? d->col.toQColor() : palette().color(backgroundRole());
+    qDrawShadePanel(&painter, x, y, w, h, palette(), true, 1, NULL);
+    if (fillCol.isValid()) {
+        const QRect rect(x + 1, y + 1, w - 2, h - 2);
+        if (fillCol.alpha() < 255) {
+            QPixmap chessboardPattern(16, 16);
+            QPainter patternPainter(&chessboardPattern);
+            patternPainter.fillRect(0, 0, 8, 8, Qt::black);
+            patternPainter.fillRect(8, 8, 8, 8, Qt::black);
+            patternPainter.fillRect(0, 8, 8, 8, Qt::white);
+            patternPainter.fillRect(8, 0, 8, 8, Qt::white);
+            patternPainter.end();
+            painter.fillRect(rect, QBrush(chessboardPattern));
+        }
+        painter.fillRect(rect, fillCol);
+    }
+
+    if (hasFocus()) {
+        QRect focusRect = style->subElementRect(QStyle::SE_PushButtonFocusRect, &butOpt, this);
+        QStyleOptionFocusRect focusOpt;
+        focusOpt.init(this);
+        focusOpt.rect            = focusRect;
+        focusOpt.backgroundColor = palette().background().color();
+        style->drawPrimitive(QStyle::PE_FrameFocusRect, &focusOpt, &painter, this);
+    }
+}
+
+QSize KisColorButton::sizeHint() const
+{
+    QStyleOptionButton opt;
+    d->initStyleOption(&opt);
+    return style()->sizeFromContents(QStyle::CT_PushButton, &opt, QSize(40, 15), this).
+           expandedTo(QApplication::globalStrut());
+}
+
+QSize KisColorButton::minimumSizeHint() const
+{
+    QStyleOptionButton opt;
+    d->initStyleOption(&opt);
+    return style()->sizeFromContents(QStyle::CT_PushButton, &opt, QSize(3, 3), this).
+           expandedTo(QApplication::globalStrut());
+}
+
+void KisColorButton::dragEnterEvent(QDragEnterEvent *event)
+{
+    event->setAccepted(_k_canDecode(event->mimeData()) && isEnabled());
+}
+
+void KisColorButton::dropEvent(QDropEvent *event)
+{
+    QColor c = _k_fromMimeData(event->mimeData());
+    if (c.isValid()) {
+        KoColor col;
+        col.fromQColor(c);
+        setColor(col);
+    }
+}
+
+void KisColorButton::keyPressEvent(QKeyEvent *e)
+{
+    int key = e->key() | e->modifiers();
+
+    if (QKeySequence::keyBindings(QKeySequence::Copy).contains(key)) {
+        QMimeData *mime = new QMimeData;
+        _k_populateMimeData(mime, color());
+        QApplication::clipboard()->setMimeData(mime, QClipboard::Clipboard);
+    } else if (QKeySequence::keyBindings(QKeySequence::Paste).contains(key)) {
+        QColor color = _k_fromMimeData(QApplication::clipboard()->mimeData(QClipboard::Clipboard));
+        KoColor col;
+        col.fromQColor(color);
+        setColor(col);
+    } else {
+        QPushButton::keyPressEvent(e);
+    }
+}
+
+void KisColorButton::mousePressEvent(QMouseEvent *e)
+{
+    d->mPos = e->pos();
+    QPushButton::mousePressEvent(e);
+}
+
+void KisColorButton::mouseMoveEvent(QMouseEvent *e)
+{
+    if ((e->buttons() & Qt::LeftButton) &&
+            (e->pos() - d->mPos).manhattanLength() > QApplication::startDragDistance()) {
+        _k_createDrag(color(), this)->start();
+        setDown(false);
+    }
+}
+
+void KisColorButton::KisColorButtonPrivate::_k_chooseColor()
+{
+    KisDlgInternalColorSelector *dialog = dialogPtr.data();
+    if (dialog) {
+        dialog->show();
+        dialog->raise();
+        dialog->activateWindow();
+        return;
+    }
+
+    KisDlgInternalColorSelector::Config cfg;
+
+    dialog = new KisDlgInternalColorSelector(q,
+                                          q->color(),
+                                          cfg,
+                                          i18n("Choose a color"));
+    //dialog->setOption(QColorDialog::ShowAlphaChannel, m_alphaChannel);
+    dialog->setAttribute(Qt::WA_DeleteOnClose);
+    connect(dialog, SIGNAL(accepted()), q, SLOT(_k_colorChosen()));
+    dialogPtr = dialog;
+    dialog->show();
+}
+
+void KisColorButton::KisColorButtonPrivate::_k_colorChosen()
+{
+    KisDlgInternalColorSelector *dialog = dialogPtr.data();
+    if (!dialog) {
+        return;
+    }
+
+    q->setColor(dialog->getCurrentColor());
+}
+
+#include "moc_kis_color_button.cpp"
diff --git a/libs/ui/widgets/kis_color_button.h b/libs/ui/widgets/kis_color_button.h
new file mode 100644
index 0000000..5c974a3
--- /dev/null
+++ b/libs/ui/widgets/kis_color_button.h
@@ -0,0 +1,124 @@
+/*
+ *  Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>, (C) 2016
+ *  This file is forked from the KF5 KColorButton
+    Copyright (C) 1997 Martin Jones (mjones at kde.org)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KisColorButton_H
+#define KisColorButton_H
+#include <kritaui_export.h>
+
+#include <KoColor.h>
+#include <QPushButton>
+
+class KisColorButtonPrivate;
+/**
+* @short A pushbutton to display or allow user selection of a color.
+*
+* This widget can be used to display or allow user selection of a color.
+*
+* @see QColorDialog
+*
+* \image html KisColorButton.png "KDE Color Button"
+*/
+class KRITAUI_EXPORT KisColorButton : public QPushButton
+{
+    Q_OBJECT
+    Q_PROPERTY(KoColor color READ color WRITE setColor NOTIFY changed USER true)
+    Q_PROPERTY(KoColor defaultColor READ defaultColor WRITE setDefaultColor)
+    Q_PROPERTY(bool alphaChannelEnabled READ isAlphaChannelEnabled WRITE setAlphaChannelEnabled)
+
+public:
+    /**
+     * Creates a color button.
+     */
+    explicit KisColorButton(QWidget *parent = 0);
+
+    /**
+     * Creates a color button with an initial color @p c.
+     */
+    explicit KisColorButton(const KoColor &c, QWidget *parent = 0);
+
+    /**
+     * Creates a color button with an initial color @p c and default color @p defaultColor.
+     */
+    KisColorButton(const KoColor &c, const KoColor &defaultColor, QWidget *parent = 0);
+
+    virtual ~KisColorButton();
+
+    /**
+     * Returns the currently chosen color.
+     */
+    KoColor color() const;
+
+    /**
+     * Sets the current color to @p c.
+     */
+    void setColor(const KoColor &c);
+
+    /**
+     * When set to true, allow the user to change the alpha component
+     * of the color. The default value is false.
+     * @since 4.5
+     */
+    void setAlphaChannelEnabled(bool alpha);
+
+    /**
+     * Returns true if the user is allowed to change the alpha component.
+     * @since 4.5
+     */
+    bool isAlphaChannelEnabled() const;
+
+    /**
+     * Returns the default color or an invalid color
+     * if no default color is set.
+     */
+    KoColor defaultColor() const;
+
+    /**
+     * Sets the default color to @p c.
+     */
+    void setDefaultColor(const KoColor &c);
+
+    QSize sizeHint() const Q_DECL_OVERRIDE;
+    QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+    /**
+     * Emitted when the color of the widget
+     * is changed, either with setColor() or via user selection.
+     */
+    void changed(const KoColor &newColor);
+
+protected:
+    void paintEvent(QPaintEvent *pe) Q_DECL_OVERRIDE;
+    void dragEnterEvent(QDragEnterEvent *) Q_DECL_OVERRIDE;
+    void dropEvent(QDropEvent *) Q_DECL_OVERRIDE;
+    void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+    void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+    void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+
+private:
+    class KisColorButtonPrivate;
+    KisColorButtonPrivate *const d;
+
+    Q_PRIVATE_SLOT(d, void _k_chooseColor())
+    Q_PRIVATE_SLOT(d, void _k_colorChosen())
+};
+
+#endif
diff --git a/plugins/dockers/specificcolorselector/kis_color_input.cc b/libs/ui/widgets/kis_color_input.cpp
similarity index 100%
rename from plugins/dockers/specificcolorselector/kis_color_input.cc
rename to libs/ui/widgets/kis_color_input.cpp
diff --git a/plugins/dockers/specificcolorselector/kis_color_input.h b/libs/ui/widgets/kis_color_input.h
similarity index 77%
rename from plugins/dockers/specificcolorselector/kis_color_input.h
rename to libs/ui/widgets/kis_color_input.h
index 45a3267..412b500 100644
--- a/plugins/dockers/specificcolorselector/kis_color_input.h
+++ b/libs/ui/widgets/kis_color_input.h
@@ -29,14 +29,15 @@ class KisIntParseSpinBox;
 class KisDoubleParseSpinBox;
 class KoColorSlider;
 class QLineEdit;
-#include "KoColorDisplayRendererInterface.h"
 
+#include <KoColorDisplayRendererInterface.h>
+#include "kritaui_export.h"
 
-class KisColorInput : public QWidget
+class KRITAUI_EXPORT KisColorInput : public QWidget
 {
     Q_OBJECT
 public:
-    KisColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer);
+    KisColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
 protected:
     void init();
     virtual QWidget* createInput() = 0;
@@ -49,11 +50,11 @@ protected:
     KoColorDisplayRendererInterface *m_displayRenderer;
 };
 
-class KisIntegerColorInput : public KisColorInput
+class KRITAUI_EXPORT KisIntegerColorInput : public KisColorInput
 {
     Q_OBJECT
 public:
-    KisIntegerColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer);
+    KisIntegerColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
 protected:
     virtual QWidget* createInput();
 public Q_SLOTS:
@@ -64,11 +65,11 @@ private:
 };
 
 
-class KisFloatColorInput : public KisColorInput
+class KRITAUI_EXPORT KisFloatColorInput : public KisColorInput
 {
     Q_OBJECT
 public:
-    KisFloatColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer);
+    KisFloatColorInput(QWidget* parent, const KoChannelInfo*, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
 protected:
     virtual QWidget* createInput();
 public Q_SLOTS:
@@ -81,11 +82,11 @@ private:
     qreal m_maxValue;
 };
 
-class KisHexColorInput : public KisColorInput
+class KRITAUI_EXPORT KisHexColorInput : public KisColorInput
 {
     Q_OBJECT
 public:
-    KisHexColorInput(QWidget* parent, KoColor* color, KoColorDisplayRendererInterface *displayRenderer);
+    KisHexColorInput(QWidget* parent, KoColor* color, KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
 protected:
     virtual QWidget* createInput();
 public Q_SLOTS:
diff --git a/libs/ui/widgets/kis_custom_image_widget.cc b/libs/ui/widgets/kis_custom_image_widget.cc
index cd63954..2269c8a 100644
--- a/libs/ui/widgets/kis_custom_image_widget.cc
+++ b/libs/ui/widgets/kis_custom_image_widget.cc
@@ -129,7 +129,9 @@ KisCustomImageWidget::KisCustomImageWidget(QWidget* parent, qint32 defWidth, qin
 
     KisConfig cfg;
     intNumLayers->setValue(cfg.numDefaultLayers());
-    cmbColor->setColor(cfg.defaultBackgroundColor());
+    KoColor bcol(KoColorSpaceRegistry::instance()->rgb8());
+    bcol.fromQColor(cfg.defaultBackgroundColor());
+    cmbColor->setColor(bcol);
     setBackgroundOpacity(cfg.defaultBackgroundOpacity());
 
     KisConfig::BackgroundStyle bgStyle = cfg.defaultBackgroundStyle();
@@ -277,7 +279,7 @@ KisDocument* KisCustomImageWidget::createNewImage()
     width = static_cast<qint32>(0.5  + KoUnit::ptToUnit(m_width, KoUnit(KoUnit::Pixel, resolution)));
     height = static_cast<qint32>(0.5 + KoUnit::ptToUnit(m_height, KoUnit(KoUnit::Pixel, resolution)));
 
-    QColor qc = cmbColor->color();
+    QColor qc = cmbColor->color().toQColor();
     qc.setAlpha(backgroundOpacity());
     KoColor bgColor(qc, cs);
 
@@ -288,7 +290,7 @@ KisDocument* KisCustomImageWidget::createNewImage()
     KisConfig cfg;
     cfg.setNumDefaultLayers(intNumLayers->value());
     cfg.setDefaultBackgroundOpacity(backgroundOpacity());
-    cfg.setDefaultBackgroundColor(cmbColor->color());
+    cfg.setDefaultBackgroundColor(cmbColor->color().toQColor());
     cfg.setDefaultBackgroundStyle(backgroundAsLayer ? KisConfig::LAYER : KisConfig::PROJECTION);
 
     return doc;
diff --git a/libs/ui/widgets/kis_screen_color_picker.cpp b/libs/ui/widgets/kis_screen_color_picker.cpp
new file mode 100644
index 0000000..975bddb
--- /dev/null
+++ b/libs/ui/widgets/kis_screen_color_picker.cpp
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>, (C) 2016
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <QDesktopWidget>
+#include <QGuiApplication>
+#include <QApplication>
+#include <QScreen>
+#include <QColor>
+#include <QVBoxLayout>
+#include <QLabel>
+#include <QPushButton>
+#include <QWindow>
+#include <QTimer>
+
+#include "kis_icon.h"
+#include "kis_screen_color_picker.h"
+#include "KisMainWindow.h"
+#include <kis_canvas2.h>
+#include "kis_wrapped_rect.h"
+#include "KisPart.h"
+
+struct KisScreenColorPicker::Private
+{
+
+    QPushButton *screenColorPickerButton = 0;
+    QLabel *lblScreenColorInfo = 0;
+
+    KoColor currentColor = KoColor();
+    KoColor beforeScreenColorPicking = KoColor();
+
+    KisScreenColorPickingEventFilter *colorPickingEventFilter = 0;
+
+#ifdef Q_OS_WIN32
+    QTimer *updateTimer = 0;
+    QWindow dummyTransparentWindow;
+#endif
+};
+
+KisScreenColorPicker::KisScreenColorPicker(QWidget *parent) : QWidget(parent), m_d(new Private)
+{
+    QVBoxLayout *layout = new QVBoxLayout();
+    this->setLayout(layout);
+    m_d->screenColorPickerButton = new QPushButton();
+    m_d->screenColorPickerButton->setIcon(kisIcon("krita_tool_color_picker"));
+    m_d->screenColorPickerButton->setMinimumHeight(25);
+    this->layout()->addWidget(m_d->screenColorPickerButton);
+    m_d->lblScreenColorInfo = new QLabel(QLatin1String("\n"));
+    this->layout()->addWidget(m_d->lblScreenColorInfo);
+    connect(m_d->screenColorPickerButton, SIGNAL(clicked()), SLOT(pickScreenColor()));
+#ifdef Q_OS_WIN32
+    m_d->updateTimer = new QTimer(q);
+    m_d->dummyTransparentWindow.resize(1, 1);
+    m_d->dummyTransparentWindow.setFlags(Qt::Tool | Qt::FramelessWindowHint);
+    connect(m_d->updateTimer, SIGNAL(timeout()), SLOT(updateColorPicking()));
+#endif
+}
+
+KisScreenColorPicker::~KisScreenColorPicker()
+{
+}
+
+KoColor KisScreenColorPicker::currentColor()
+{
+    return m_d->currentColor;
+}
+
+void KisScreenColorPicker::pickScreenColor()
+{
+    if (!m_d->colorPickingEventFilter)
+        m_d->colorPickingEventFilter = new KisScreenColorPickingEventFilter(this);
+    this->installEventFilter(m_d->colorPickingEventFilter);
+    // If user pushes Escape, the last color before picking will be restored.
+    m_d->beforeScreenColorPicking = currentColor();
+#ifndef QT_NO_CURSOR
+    grabMouse(Qt::CrossCursor);
+#else
+    grabMouse();
+#endif
+
+#ifdef Q_OS_WIN32 // excludes WinCE and WinRT
+    // On Windows mouse tracking doesn't work over other processes's windows
+    m_d->updateTimer->start(30);
+
+    // HACK: Because mouse grabbing doesn't work across processes, we have to have a dummy,
+    // invisible window to catch the mouse click, otherwise we will click whatever we clicked
+    // and loose focus.
+    m_d->dummyTransparentWindow.show();
+#endif
+    grabKeyboard();
+    /* With setMouseTracking(true) the desired color can be more precisely picked up,
+     * and continuously pushing the mouse button is not necessary.
+     */
+    setMouseTracking(true);
+
+    //emit to the rest of the dialog to disable.
+    Q_EMIT sigPleaseDisableEverything(true);
+    m_d->screenColorPickerButton->setDisabled(true);
+
+    const QPoint globalPos = QCursor::pos();
+    setCurrentColor(grabScreenColor(globalPos));
+    updateColorLabelText(globalPos);
+}
+
+void KisScreenColorPicker::setCurrentColor(KoColor c)
+{
+    m_d->currentColor = c;
+}
+
+KoColor KisScreenColorPicker::grabScreenColor(const QPoint &p)
+{
+    // First check whether we're clicking on a Krita window for some real color picking
+    Q_FOREACH(KisView *view, KisPart::instance()->views()) {
+        QWidget *canvasWidget = view->canvasBase()->canvasWidget();
+        QPoint widgetPoint = canvasWidget->mapFromGlobal(p);
+
+        if (canvasWidget->rect().contains(widgetPoint)) {
+            QPointF imagePoint = view->canvasBase()->coordinatesConverter()->widgetToImage(widgetPoint);
+            KisImageWSP image = view->image();
+
+            if (image) {
+                if (image->wrapAroundModePermitted()) {
+                    imagePoint = KisWrappedRect::ptToWrappedPt(imagePoint.toPoint(), image->bounds());
+                }
+                KoColor pickedColor = KoColor();
+                image->projection()->pixel(imagePoint.x(), imagePoint.y(), &pickedColor);
+                return pickedColor;
+            }
+        }
+    }
+
+    // And otherwise, we'll check the desktop
+    const QDesktopWidget *desktop = QApplication::desktop();
+    const QPixmap pixmap = QGuiApplication::screens().at(desktop->screenNumber())->grabWindow(desktop->winId(),
+                                                                                              p.x(), p.y(), 1, 1);
+    QImage i = pixmap.toImage();
+    KoColor col = KoColor();
+    col.fromQColor(QColor::fromRgb(i.pixel(0, 0)));
+    return col;
+}
+
+void KisScreenColorPicker::updateColorLabelText(const QPoint &globalPos)
+{
+    KoColor col = grabScreenColor(globalPos);
+    QString colname = KoColor::toQString(col);
+    QString location = QString::number(globalPos.x())+QString(", ")+QString::number(globalPos.y());
+    m_d->lblScreenColorInfo->setWordWrap(true);
+    m_d->lblScreenColorInfo->setText(location+QString(": ")+colname);
+}
+
+bool KisScreenColorPicker::handleColorPickingMouseMove(QMouseEvent *e)
+{
+    // If the cross is visible the grabbed color will be black most of the times
+    //cp->setCrossVisible(!cp->geometry().contains(e->pos()));
+
+
+    continueUpdateColorPicking(e->globalPos());
+    return true;
+}
+
+bool KisScreenColorPicker::handleColorPickingMouseButtonRelease(QMouseEvent *e)
+{
+    setCurrentColor(grabScreenColor(e->globalPos()));
+    Q_EMIT sigNewColorPicked(currentColor());
+    releaseColorPicking();
+    return true;
+}
+
+bool KisScreenColorPicker::handleColorPickingKeyPress(QKeyEvent *e)
+{
+    //Q_Q(QColorDialog);
+    if (e->matches(QKeySequence::Cancel)) {
+        releaseColorPicking();
+        setCurrentColor(m_d->beforeScreenColorPicking);
+    } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
+        setCurrentColor(grabScreenColor(QCursor::pos()));
+        releaseColorPicking();
+    }
+    e->accept();
+    return true;
+}
+
+void KisScreenColorPicker::releaseColorPicking()
+{
+    //Q_Q(QColorDialog);
+    //cp->setCrossVisible(true);
+    removeEventFilter(m_d->colorPickingEventFilter);
+    releaseMouse();
+#ifdef Q_OS_WIN32
+    m_d->updateTimer->stop();
+    m_d->dummyTransparentWindow.setVisible(false);
+#endif
+    releaseKeyboard();
+    setMouseTracking(false);
+    m_d->lblScreenColorInfo->setText(QLatin1String("\n"));
+    //emit enable signal
+    Q_EMIT sigPleaseDisableEverything(false);
+    m_d->screenColorPickerButton->setDisabled(false);
+}
+
+void KisScreenColorPicker::changeEvent(QEvent *e)
+{
+    QWidget::changeEvent(e);
+}
+
+void KisScreenColorPicker::updateColorPicking()
+{
+#ifndef QT_NO_CURSOR
+    //Q_Q(QColorDialog);
+    static QPoint lastGlobalPos;
+    QPoint newGlobalPos = QCursor::pos();
+    if (lastGlobalPos == newGlobalPos)
+        return;
+    lastGlobalPos = newGlobalPos;
+
+    if (!rect().contains(mapFromGlobal(newGlobalPos))) { // Inside the dialog mouse tracking works, handleColorPickingMouseMove will be called
+        continueUpdateColorPicking(newGlobalPos);
+#ifdef Q_OS_WIN32
+        m_dummyTransparentWindow.setPosition(newGlobalPos);
+#endif
+    }
+#endif // ! QT_NO_CURSOR
+}
+
+void KisScreenColorPicker::continueUpdateColorPicking(const QPoint &globalPos)
+{
+    const KoColor color = grabScreenColor(globalPos);
+    // QTBUG-39792, do not change standard, custom color selectors while moving as
+    // otherwise it is not possible to pre-select a custom cell for assignment.
+    setCurrentColor(color);
+    updateColorLabelText(globalPos);
+
+}
+
+// Event filter to be installed on the dialog while in color-picking mode.
+KisScreenColorPickingEventFilter::KisScreenColorPickingEventFilter(KisScreenColorPicker *w, QObject *parent) : QObject(parent), m_w(w)
+{}
+
+bool KisScreenColorPickingEventFilter::eventFilter(QObject *, QEvent *event)
+{
+    switch (event->type()) {
+    case QEvent::MouseMove:
+        return m_w->handleColorPickingMouseMove(static_cast<QMouseEvent *>(event));
+    case QEvent::MouseButtonRelease:
+        return m_w->handleColorPickingMouseButtonRelease(static_cast<QMouseEvent *>(event));
+    case QEvent::KeyPress:
+        return m_w->handleColorPickingKeyPress(static_cast<QKeyEvent *>(event));
+    default:
+        break;
+    }
+    return false;
+}
+
+
+#include "kis_screen_color_picker.moc"
diff --git a/libs/ui/widgets/kis_screen_color_picker.h b/libs/ui/widgets/kis_screen_color_picker.h
new file mode 100644
index 0000000..3fdb6a7
--- /dev/null
+++ b/libs/ui/widgets/kis_screen_color_picker.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>, (C) 2016
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KISSCREENCOLORPICKER_H
+#define KISSCREENCOLORPICKER_H
+
+#include <QScopedPointer>
+#include <QEvent>
+#include <QMouseEvent>
+
+#include "KoColor.h"
+
+#include "kritaui_export.h"
+
+/**
+ * @brief The KisScreenColorPicker class
+ * Based on the original QColorDialog's screen color picker, this class provides a button
+ * that can be used to activate a colorpicker that can pick from anywhere on the screen.
+ */
+class KRITAUI_EXPORT KisScreenColorPicker : public QWidget
+{
+    Q_OBJECT
+public:
+    explicit KisScreenColorPicker(QWidget *parent = 0);
+    ~KisScreenColorPicker();
+
+    KoColor currentColor();
+
+    bool handleColorPickingMouseMove(QMouseEvent *e);
+    bool handleColorPickingMouseButtonRelease(QMouseEvent *e);
+    bool handleColorPickingKeyPress(QKeyEvent *e);
+
+Q_SIGNALS:
+    void sigNewColorPicked(KoColor c);
+    void sigPleaseDisableEverything(bool disable);
+
+public Q_SLOTS:
+    void pickScreenColor();
+
+private Q_SLOTS:
+    void updateColorPicking();
+protected:
+    void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+private:
+    struct Private; //The private struct
+    const QScopedPointer<Private> m_d; //the private pointer
+
+    void setCurrentColor(KoColor c);
+    KoColor grabScreenColor(const QPoint &p);
+    void updateColorLabelText(const QPoint &globalPos);
+    void releaseColorPicking();
+    void continueUpdateColorPicking(const QPoint &globalPos);
+};
+
+class KisScreenColorPickingEventFilter : public QObject {
+public:
+    explicit KisScreenColorPickingEventFilter(KisScreenColorPicker *w, QObject *parent = 0);
+
+    bool eventFilter(QObject *, QEvent *event) Q_DECL_OVERRIDE;
+private:
+    KisScreenColorPicker *m_w;
+};
+
+#endif // KISSCREENCOLORPICKER_H
diff --git a/libs/ui/widgets/kis_spinbox_color_selector.cpp b/libs/ui/widgets/kis_spinbox_color_selector.cpp
new file mode 100644
index 0000000..1d8f211
--- /dev/null
+++ b/libs/ui/widgets/kis_spinbox_color_selector.cpp
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>, (C) 2016
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_spinbox_color_selector.h"
+#include <QFormLayout>
+#include <QLabel>
+#include "kis_double_parse_spin_box.h"
+#include "kis_int_parse_spin_box.h"
+#include "kis_signal_compressor.h"
+
+#include "KoChannelInfo.h"
+#include "KoColorSpaceTraits.h"
+#include "KoColorSpaceMaths.h"
+#include "KoColorSpaceRegistry.h"
+
+struct KisSpinboxColorSelector::Private
+{
+    QList <KisIntParseSpinBox*> spinBoxList;
+    QList <KisDoubleParseSpinBox*> doubleSpinBoxList;
+    KoColor color;
+    const KoColorSpace *cs;
+    bool chooseAlpha = false;
+};
+
+KisSpinboxColorSelector::KisSpinboxColorSelector(QWidget *parent) : QWidget(parent) , m_d(new Private)
+{
+    this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+
+    KoColor color = KoColor();
+    m_d->color = color;
+    slotSetColorSpace(m_d->color.colorSpace());
+}
+KisSpinboxColorSelector::~KisSpinboxColorSelector()
+{
+
+}
+
+void KisSpinboxColorSelector::slotSetColor(KoColor color)
+{
+    m_d->color = color;
+    if (m_d->color.colorSpace() != m_d->cs) {
+        slotSetColorSpace(m_d->color.colorSpace());
+    }
+    updateSpinboxesWithNewValues();
+}
+
+void KisSpinboxColorSelector::slotSetColorSpace(const KoColorSpace *cs)
+{
+    if (cs == m_d->cs) {
+        return;
+    }
+
+    m_d->cs = KoColorSpaceRegistry::instance()->colorSpace(cs->colorModelId().id(), cs->colorDepthId().id(), cs->profile());
+
+    //remake spinboxes
+    if (this->layout()) {
+        qDeleteAll(this->children());
+    }
+    m_d->spinBoxList.clear();
+    m_d->doubleSpinBoxList.clear();
+
+    QFormLayout *layout = new QFormLayout(this);
+    QList<KoChannelInfo *> channels = KoChannelInfo::displayOrderSorted(m_d->cs->channels());
+    Q_FOREACH (KoChannelInfo* channel, channels) {
+        QString inputLabel = channel->name();
+        switch (channel->channelValueType()) {
+        case KoChannelInfo::UINT8: {
+            KisIntParseSpinBox *input = new KisIntParseSpinBox(this);
+            input->setMinimum(0);
+            input->setMaximum(0xFF);
+            m_d->spinBoxList.append(input);
+            layout->addRow(inputLabel,input);
+            if (input) {
+                connect(input, SIGNAL(valueChanged(int)), this,  SLOT(slotUpdateFromSpinBoxes()));
+            }
+            if (channel->channelType()==KoChannelInfo::ALPHA && m_d->chooseAlpha == false) {
+                input->setEnabled(false);
+                input->blockSignals(true);
+            }
+        }
+            break;
+        case KoChannelInfo::UINT16: {
+            KisIntParseSpinBox *input = new KisIntParseSpinBox(this);
+            input->setMinimum(0);
+            input->setMaximum(0xFFFF);
+            m_d->spinBoxList.append(input);
+            layout->addRow(inputLabel,input);
+            if (input) {
+                connect(input, SIGNAL(valueChanged(int)), this,  SLOT(slotUpdateFromSpinBoxes()));
+            }
+            if (channel->channelType()==KoChannelInfo::ALPHA && m_d->chooseAlpha == false) {
+                input->setEnabled(false);
+                input->blockSignals(true);
+            }
+        }
+            break;
+        case KoChannelInfo::UINT32: {
+            KisIntParseSpinBox *input = new KisIntParseSpinBox(this);
+            input->setMinimum(0);
+            input->setMaximum(0xFFFFFFFF);
+            m_d->spinBoxList.append(input);
+            layout->addRow(inputLabel,input);
+            if (input) {
+                connect(input, SIGNAL(valueChanged(int)), this,  SLOT(slotUpdateFromSpinBoxes()));
+            }
+            if (channel->channelType()==KoChannelInfo::ALPHA && m_d->chooseAlpha == false) {
+                input->setEnabled(false);
+                input->blockSignals(true);
+            }
+        }
+            break;
+        case KoChannelInfo::FLOAT16:
+        case KoChannelInfo::FLOAT32: {
+            KisDoubleParseSpinBox *input = new KisDoubleParseSpinBox(this);
+            input->setMinimum(0);
+            input->setMaximum(KoColorSpaceMathsTraits<float>::max);
+            input->setSingleStep(0.1);
+            m_d->doubleSpinBoxList.append(input);
+            qDebug()<<"add "<<channel->name()<<"doubleSpinBoxList "<<m_d->doubleSpinBoxList.size();
+            layout->addRow(inputLabel,input);
+            if (input) {
+                connect(input, SIGNAL(valueChanged(double)), this,  SLOT(slotUpdateFromSpinBoxes()));
+            }
+            if (channel->channelType()==KoChannelInfo::ALPHA && m_d->chooseAlpha == false) {
+                input->setEnabled(false);
+                input->blockSignals(true);
+            }
+        }
+            break;
+        default:
+            Q_ASSERT(false);
+        }
+
+    }
+    this->setLayout(layout);
+}
+
+void KisSpinboxColorSelector::createColorFromSpinboxValues()
+{
+    KoColor newColor;
+    int channelcount = m_d->cs->channelCount();
+    quint8 *data = new quint8[m_d->cs->pixelSize()];
+    QVector <float> channelValues(channelcount);
+    channelValues.fill(1.0);
+    QList<KoChannelInfo *> channels = KoChannelInfo::displayOrderSorted(m_d->cs->channels());
+
+    for (int i=0; i<abs(m_d->cs->colorChannelCount()); i++) {
+        int channelposition = KoChannelInfo::displayPositionToChannelIndex(i, m_d->cs->channels());
+
+        if (channels.at(i)->channelValueType()==KoChannelInfo::UINT8 && m_d->spinBoxList.at(i)){
+
+            int value = m_d->spinBoxList.at(i)->value();
+            channelValues[channelposition] = KoColorSpaceMaths<quint8,float>::scaleToA(value);
+
+        } else if (channels.at(i)->channelValueType()==KoChannelInfo::UINT16 && m_d->spinBoxList.at(i)){
+
+            channelValues[channelposition] = KoColorSpaceMaths<quint16,float>::scaleToA(m_d->spinBoxList.at(i)->value());
+
+        } else if ((channels.at(i)->channelValueType()==KoChannelInfo::FLOAT16 ||
+                    channels.at(i)->channelValueType()==KoChannelInfo::FLOAT32 ||
+                    channels.at(i)->channelValueType()==KoChannelInfo::FLOAT64) && m_d->doubleSpinBoxList.at(i)) {
+
+            channelValues[channelposition] = m_d->doubleSpinBoxList.at(i)->value();
+
+        }
+    }
+
+    m_d->cs->fromNormalisedChannelsValue(data, channelValues);
+    newColor.setColor(data, m_d->cs);
+    newColor.setOpacity(m_d->color.opacityU8());
+
+    m_d->color = newColor;
+}
+
+void KisSpinboxColorSelector::slotUpdateFromSpinBoxes()
+{
+    createColorFromSpinboxValues();
+    emit sigNewColor(m_d->color);
+}
+
+void KisSpinboxColorSelector::updateSpinboxesWithNewValues()
+{
+    int channelcount = m_d->cs->channelCount();
+    QVector <float> channelValues(channelcount);
+    channelValues.fill(1.0);
+    m_d->cs->normalisedChannelsValue(m_d->color.data(), channelValues);
+    QList<KoChannelInfo *> channels = KoChannelInfo::displayOrderSorted(m_d->cs->channels());
+
+    int i;
+    /*while (QLayoutItem *item = this->layout()->takeAt(0))
+    {
+        item->widget()->blockSignals(true);
+    }*/
+    for (i=0; i<m_d->spinBoxList.size(); i++) {
+        m_d->spinBoxList.at(i)->blockSignals(true);
+    }
+    for (i=0; i<m_d->doubleSpinBoxList.size(); i++) {
+        m_d->doubleSpinBoxList.at(i)->blockSignals(true);
+    }
+
+    for (i=0; i<abs(m_d->cs->colorChannelCount()); i++) {
+        int channelposition = KoChannelInfo::displayPositionToChannelIndex(i, m_d->cs->channels());
+        if (channels.at(i)->channelValueType() == KoChannelInfo::UINT8 && m_d->spinBoxList.at(i)) {
+            int value = KoColorSpaceMaths<float, quint8>::scaleToA(channelValues[channelposition]);
+            m_d->spinBoxList.at(i)->setValue(value);
+        } else if (channels.at(i)->channelValueType() == KoChannelInfo::UINT16 && m_d->spinBoxList.at(i)) {
+            m_d->spinBoxList.at(i)->setValue(KoColorSpaceMaths<float, quint16>::scaleToA(channelValues[channelposition]));
+        } else if ((channels.at(i)->channelValueType()==KoChannelInfo::FLOAT16 ||
+                    channels.at(i)->channelValueType()==KoChannelInfo::FLOAT32 ||
+                    channels.at(i)->channelValueType()==KoChannelInfo::FLOAT64) && m_d->doubleSpinBoxList.at(i)) {
+            m_d->doubleSpinBoxList.at(i)->setValue(channelValues[channelposition]);
+        }
+    }
+
+    for (i=0; i<m_d->spinBoxList.size(); i++) {
+        m_d->spinBoxList.at(i)->blockSignals(false);
+    }
+    for (i=0; i<m_d->doubleSpinBoxList.size(); i++) {
+        m_d->doubleSpinBoxList.at(i)->blockSignals(false);
+    }
+    /*while (QLayoutItem *item = this->layout()->takeAt(0))
+    {
+        item->widget()->blockSignals(false);
+    }*/
+}
+
+
diff --git a/libs/ui/widgets/kis_spinbox_color_selector.h b/libs/ui/widgets/kis_spinbox_color_selector.h
new file mode 100644
index 0000000..7c3106f
--- /dev/null
+++ b/libs/ui/widgets/kis_spinbox_color_selector.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>, (C) 2016
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef KISSPINBOXCOLORSELECTOR_H
+#define KISSPINBOXCOLORSELECTOR_H
+
+#include <QWidget>
+#include "kritaui_export.h"
+#include <QScopedPointer>
+#include "KoColor.h"
+#include "KoColorSpace.h"
+
+/**
+ * @brief The KisSpinboxColorSelector class
+ * This will give a widget with spinboxes depending on the color space
+ * Take responsibility for changing the color space.
+ */
+class KRITAUI_EXPORT KisSpinboxColorSelector : public QWidget
+{
+    Q_OBJECT
+public:
+    explicit KisSpinboxColorSelector(QWidget *parent);
+    ~KisSpinboxColorSelector();
+
+    void chooseAlpha(bool chooseAlpha);
+
+Q_SIGNALS:
+
+    void sigNewColor(KoColor color);
+
+public Q_SLOTS:
+
+    void slotSetColorSpace(const KoColorSpace *cs);
+    void slotSetColor(KoColor color);
+private Q_SLOTS:
+    void slotUpdateFromSpinBoxes();
+private:
+    struct Private;
+    const QScopedPointer<Private> m_d;
+    void createColorFromSpinboxValues();
+    void updateSpinboxesWithNewValues();
+};
+
+#endif // KISSPINBOXCOLORSELECTOR_H
diff --git a/libs/ui/widgets/kis_visual_color_selector.cpp b/libs/ui/widgets/kis_visual_color_selector.cpp
new file mode 100644
index 0000000..ab01388
--- /dev/null
+++ b/libs/ui/widgets/kis_visual_color_selector.cpp
@@ -0,0 +1,1602 @@
+/*
+ * Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>, (C) 2016
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "kis_visual_color_selector.h"
+
+#include <QColor>
+#include <QPixmap>
+#include <QPainter>
+#include <QPainterPath>
+#include <QRect>
+#include <QVector>
+#include <QVBoxLayout>
+#include <QList>
+#include <QPolygon>
+#include <QRect>
+#include <QtMath>
+
+#include <KSharedConfig>
+#include <KConfigGroup>
+
+#include "KoColorConversions.h"
+#include "KoColorDisplayRendererInterface.h"
+#include "KoChannelInfo.h"
+#include <KoColorModelStandardIds.h>
+#include <QPointer>
+#include "kis_signal_compressor.h"
+
+struct KisVisualColorSelector::Private
+{
+    KoColor currentcolor;
+    const KoColorSpace *currentCS;
+    QList <KisVisualColorSelectorShape*> widgetlist;
+    bool updateSelf = false;
+    bool updateLonesome = false; //for Modal dialogs.
+    bool circular = false;
+    const KoColorDisplayRendererInterface *displayRenderer = 0;
+    KisVisualColorSelector::Configuration acs_config;
+    //Current coordinates.
+    KisSignalCompressor *updateTimer = 0;
+    QVector <qreal> currentCoordinates;
+};
+
+KisVisualColorSelector::KisVisualColorSelector(QWidget *parent) : QWidget(parent), m_d(new Private)
+{
+    this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
+    QVBoxLayout *layout = new QVBoxLayout;
+    this->setLayout(layout);
+
+    KConfigGroup cfg =  KSharedConfig::openConfig()->group("advancedColorSelector");
+    m_d->acs_config = Configuration::fromString(cfg.readEntry("colorSelectorConfiguration", KisVisualColorSelector::Configuration().toString()));
+
+}
+
+KisVisualColorSelector::~KisVisualColorSelector()
+{
+
+}
+
+void KisVisualColorSelector::slotSetColor(KoColor c)
+{
+    if (m_d->updateSelf==false) {
+        m_d->currentcolor = c;
+        if (m_d->currentCS != c.colorSpace()) {
+            slotsetColorSpace(c.colorSpace());
+        }
+    }
+    updateSelectorElements(QObject::sender());
+}
+
+void KisVisualColorSelector::slotsetColorSpace(const KoColorSpace *cs)
+{
+    if (m_d->currentCS != cs)
+    {
+        m_d->currentCS = cs;
+        slotRebuildSelectors();
+    }
+
+}
+
+void KisVisualColorSelector::setConfig(bool forceCircular, bool forceSelfUpdate)
+{
+    m_d->updateLonesome = forceSelfUpdate;
+    m_d->circular = forceCircular;
+}
+
+KoColor KisVisualColorSelector::getCurrentColor()
+{
+    return m_d->currentcolor;
+}
+
+void KisVisualColorSelector::ConfigurationChanged()
+{
+    m_d->updateTimer =  new KisSignalCompressor(100 /* ms */, KisSignalCompressor::POSTPONE, this);
+    m_d->updateTimer->start();
+    connect(m_d->updateTimer, SIGNAL(timeout()), SLOT(slotRebuildSelectors()), Qt::UniqueConnection);
+}
+
+void KisVisualColorSelector::slotRebuildSelectors()
+{
+    KConfigGroup cfg =  KSharedConfig::openConfig()->group("advancedColorSelector");
+    m_d->acs_config = Configuration::fromString(cfg.readEntry("colorSelectorConfiguration", KisVisualColorSelector::Configuration().toString()));
+
+    if (this->children().at(0)) {
+        qDeleteAll(this->children());
+    }
+    m_d->widgetlist.clear();
+    QLayout *layout = new QHBoxLayout;
+    //redraw all the widgets.
+    int sizeValue = qMin(width(), height());
+    int borderWidth = qMax(sizeValue*0.1, 20.0);
+
+    if (m_d->currentCS->colorChannelCount() == 1) {
+        KisVisualColorSelectorShape *bar;
+        if (m_d->circular==false) {
+            bar =  new KisVisualRectangleSelectorShape(this, KisVisualColorSelectorShape::onedimensional,KisVisualColorSelectorShape::Channel, m_d->currentCS, 0, 0,m_d->displayRenderer, borderWidth);
+            bar->setMaximumWidth(width()*0.1);
+            bar->setMaximumHeight(height());
+
+        } else {
+            bar=  new KisVisualEllipticalSelectorShape(this, KisVisualColorSelectorShape::onedimensional,KisVisualColorSelectorShape::Channel, m_d->currentCS, 0, 0,m_d->displayRenderer, borderWidth, KisVisualEllipticalSelectorShape::borderMirrored);
+            layout->setMargin(0);
+        }
+        connect (bar, SIGNAL(sigNewColor(KoColor)), this, SLOT(updateFromWidgets(KoColor)));
+        layout->addWidget(bar);
+        m_d->widgetlist.append(bar);
+    } else if (m_d->currentCS->colorChannelCount() == 3) {
+        QRect newrect(0,0, this->geometry().width(), this->geometry().height());
+
+
+        KisVisualColorSelectorShape::ColorModel modelS = KisVisualColorSelectorShape::HSV;
+        int channel1 = 0;
+        int channel2 = 1;
+        int channel3 = 2;
+
+        switch(m_d->acs_config.subTypeParameter)
+        {
+        case H:
+            channel1 = 0; break;
+        case hsyS:
+        case hsiS:
+        case hslS:
+        case hsvS:
+            channel1 = 1; break;
+        case V:
+        case L:
+        case I:
+        case Y:
+            channel1 = 2; break;
+        }
+
+        switch(m_d->acs_config.mainTypeParameter)
+        {
+        case hsySH:
+            modelS = KisVisualColorSelectorShape::HSY;
+            channel2 = 0;
+            channel3 = 1;
+            break;
+        case hsiSH:
+            modelS = KisVisualColorSelectorShape::HSI;
+            channel2 = 0;
+            channel3 = 1;
+            break;
+        case hslSH:
+            modelS = KisVisualColorSelectorShape::HSL;
+            channel2 = 0;
+            channel3 = 1;
+            break;
+        case hsvSH:
+            modelS = KisVisualColorSelectorShape::HSV;
+            channel2 = 0;
+            channel3 = 1;
+            break;
+        case YH:
+            modelS = KisVisualColorSelectorShape::HSY;
+            channel2 = 0;
+            channel3 = 2;
+            break;
+        case LH:
+            modelS = KisVisualColorSelectorShape::HSL;
+            channel2 = 0;
+            channel3 = 2;
+            break;
+        case IH:
+            modelS = KisVisualColorSelectorShape::HSL;
+            channel2 = 0;
+            channel3 = 2;
+            break;
+        case VH:
+            modelS = KisVisualColorSelectorShape::HSV;
+            channel2 = 0;
+            channel3 = 2;
+            break;
+        case SY:
+            modelS = KisVisualColorSelectorShape::HSY;
+            channel2 = 1;
+            channel3 = 2;
+            break;
+        case SI:
+            modelS = KisVisualColorSelectorShape::HSI;
+            channel2 = 1;
+            channel3 = 2;
+            break;
+        case SL:
+            modelS = KisVisualColorSelectorShape::HSL;
+            channel2 = 1;
+            channel3 = 2;
+            break;
+        case SV:
+        case SV2:
+            modelS = KisVisualColorSelectorShape::HSV;
+            channel2 = 1;
+            channel3 = 2;
+            break;
+        }
+        if (m_d->acs_config.mainType==Triangle) {
+            modelS = KisVisualColorSelectorShape::HSV;
+            //Triangle only really works in HSV mode.
+        }
+        KisVisualColorSelectorShape *bar;
+        if (m_d->acs_config.subType==Ring) {
+            bar =  new KisVisualEllipticalSelectorShape(this,
+                                                        KisVisualColorSelectorShape::onedimensional,
+                                                        modelS,
+                                                        m_d->currentCS, channel1, channel1,
+                                                        m_d->displayRenderer, borderWidth,KisVisualEllipticalSelectorShape::border);
+            bar->resize(sizeValue, sizeValue);
+        } else if (m_d->acs_config.subType==Slider && m_d->circular==false) {
+            bar =  new KisVisualRectangleSelectorShape(this,
+                                                       KisVisualColorSelectorShape::onedimensional,
+                                                       modelS,
+                                                       m_d->currentCS, channel1, channel1,
+                                                       m_d->displayRenderer, borderWidth);
+            bar->setMaximumWidth(borderWidth);
+            bar->setMinimumWidth(borderWidth);
+            bar->setMinimumHeight(sizeValue);
+        } else if (m_d->acs_config.subType==Slider && m_d->circular==true) {
+            bar =  new KisVisualEllipticalSelectorShape(this,
+                                                       KisVisualColorSelectorShape::onedimensional,
+                                                       modelS,
+                                                       m_d->currentCS, channel1, channel1,
+                                                       m_d->displayRenderer, borderWidth, KisVisualEllipticalSelectorShape::borderMirrored);
+            bar->resize(sizeValue, sizeValue);
+        }
+
+        bar->setColor(m_d->currentcolor);
+        m_d->widgetlist.append(bar);
+
+        KisVisualColorSelectorShape *block;
+        if (m_d->acs_config.mainType==Triangle) {
+            block =  new KisVisualTriangleSelectorShape(this, KisVisualColorSelectorShape::twodimensional,
+                                                        modelS,
+                                                        m_d->currentCS, channel2, channel3,
+                                                        m_d->displayRenderer);
+            block->setGeometry(bar->getSpaceForTriangle(newrect));
+        } else if (m_d->acs_config.mainType==Square) {
+            block =  new KisVisualRectangleSelectorShape(this, KisVisualColorSelectorShape::twodimensional,
+                                                         modelS,
+                                                         m_d->currentCS, channel2, channel3,
+                                                         m_d->displayRenderer);
+            block->setGeometry(bar->getSpaceForSquare(newrect));
+        } else {
+            block =  new KisVisualEllipticalSelectorShape(this, KisVisualColorSelectorShape::twodimensional,
+                                                          modelS,
+                                                          m_d->currentCS, channel2, channel3,
+                                                          m_d->displayRenderer);
+            block->setGeometry(bar->getSpaceForCircle(newrect));
+
+        }
+
+        block->setColor(m_d->currentcolor);
+        connect (bar, SIGNAL(sigNewColor(KoColor)), block, SLOT(setColorFromSibling(KoColor)));
+        connect (block, SIGNAL(sigNewColor(KoColor)), SLOT(updateFromWidgets(KoColor)));
+        connect (bar, SIGNAL(sigHSXchange()), SLOT(HSXwrangler()));
+        connect (block, SIGNAL(sigHSXchange()), SLOT(HSXwrangler()));
+        m_d->widgetlist.append(block);
+
+
+    } else if (m_d->currentCS->colorChannelCount() == 4) {
+        KisVisualRectangleSelectorShape *block =  new KisVisualRectangleSelectorShape(this, KisVisualRectangleSelectorShape::twodimensional,KisVisualColorSelectorShape::Channel, m_d->currentCS, 0, 1);
+        KisVisualRectangleSelectorShape *block2 =  new KisVisualRectangleSelectorShape(this, KisVisualRectangleSelectorShape::twodimensional,KisVisualColorSelectorShape::Channel, m_d->currentCS, 2, 3);
+        block->setMaximumWidth(width()*0.5);
+        block->setMaximumHeight(height());
+        block2->setMaximumWidth(width()*0.5);
+        block2->setMaximumHeight(height());
+        block->setColor(m_d->currentcolor);
+        block2->setColor(m_d->currentcolor);
+        connect (block, SIGNAL(sigNewColor(KoColor)), block2, SLOT(setColorFromSibling(KoColor)));
+        connect (block2, SIGNAL(sigNewColor(KoColor)), SLOT(updateFromWidgets(KoColor)));
+        layout->addWidget(block);
+        layout->addWidget(block2);
+        m_d->widgetlist.append(block);
+        m_d->widgetlist.append(block2);
+    }
+    this->setLayout(layout);
+}
+
+void KisVisualColorSelector::setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer) {
+    m_d->displayRenderer = displayRenderer;
+    if (m_d->widgetlist.size()>0) {
+        Q_FOREACH (KisVisualColorSelectorShape *shape, m_d->widgetlist) {
+            shape->setDisplayRenderer(displayRenderer);
+        }
+    }
+}
+
+void KisVisualColorSelector::updateSelectorElements(QObject *source)
+{
+    //first lock all elements from sending updates, then update all elements.
+    Q_FOREACH (KisVisualColorSelectorShape *shape, m_d->widgetlist) {
+        shape->blockSignals(true);
+    }
+
+    Q_FOREACH (KisVisualColorSelectorShape *shape, m_d->widgetlist) {
+        if (shape!=source) {
+            if (m_d->updateSelf) {
+                shape->setColorFromSibling(m_d->currentcolor);
+            } else {
+                shape->setColor(m_d->currentcolor);
+            }
+        }
+    }
+    Q_FOREACH (KisVisualColorSelectorShape *shape, m_d->widgetlist) {
+        shape->blockSignals(false);
+    }
+
+}
+
+void KisVisualColorSelector::updateFromWidgets(KoColor c)
+{
+    m_d->currentcolor = c;
+    m_d->updateSelf = true;
+    if (m_d->updateLonesome) {
+        slotSetColor(c);
+    } else {
+        Q_EMIT sigNewColor(c);
+    }
+}
+
+void KisVisualColorSelector::leaveEvent(QEvent *)
+{
+    m_d->updateSelf = false;
+}
+
+void KisVisualColorSelector::resizeEvent(QResizeEvent *) {
+    int sizeValue = qMin(width(), height());
+    int borderWidth = qMax(sizeValue*0.1, 20.0);
+    QRect newrect(0,0, this->geometry().width(), this->geometry().height());
+    if (!m_d->currentCS) {
+        slotsetColorSpace(m_d->currentcolor.colorSpace());
+    }
+    if (m_d->currentCS->colorChannelCount()==3) {
+        if (m_d->acs_config.subType==Ring) {
+            m_d->widgetlist.at(0)->resize(sizeValue,sizeValue);
+        } else if (m_d->acs_config.subType==Slider && m_d->circular==false) {
+            m_d->widgetlist.at(0)->setMaximumWidth(borderWidth);
+            m_d->widgetlist.at(0)->setMinimumWidth(borderWidth);
+            m_d->widgetlist.at(0)->setMinimumHeight(sizeValue);
+            m_d->widgetlist.at(0)->setMaximumHeight(sizeValue);
+        } else if (m_d->acs_config.subType==Slider && m_d->circular==true) {
+            m_d->widgetlist.at(0)->resize(sizeValue,sizeValue);
+        }
+        m_d->widgetlist.at(0)->setBorderWidth(borderWidth);
+
+        if (m_d->acs_config.mainType==Triangle) {
+            m_d->widgetlist.at(1)->setGeometry(m_d->widgetlist.at(0)->getSpaceForTriangle(newrect));
+        } else if (m_d->acs_config.mainType==Square) {
+            m_d->widgetlist.at(1)->setGeometry(m_d->widgetlist.at(0)->getSpaceForSquare(newrect));
+        } else if (m_d->acs_config.mainType==Wheel) {
+            m_d->widgetlist.at(1)->setGeometry(m_d->widgetlist.at(0)->getSpaceForCircle(newrect));
+        }
+    }
+    Q_FOREACH (KisVisualColorSelectorShape *shape, m_d->widgetlist) {
+        shape->update();
+    }
+}
+
+void KisVisualColorSelector::HSXwrangler()
+{
+    m_d->currentCoordinates = QVector <qreal>(3);
+
+    QVector <qreal> w1 = m_d->widgetlist.at(0)->getHSX(m_d->currentCoordinates, true);
+    QVector <qreal> w2 = m_d->widgetlist.at(1)->getHSX(m_d->currentCoordinates, true);
+    QVector <int> ch(3);
+
+    ch[0] = m_d->widgetlist.at(0)->getChannels().at(0);
+    ch[1] = m_d->widgetlist.at(1)->getChannels().at(0);
+    ch[2] = m_d->widgetlist.at(1)->getChannels().at(1);
+
+    m_d->currentCoordinates[ch[0]] = w1[ch[0]];
+    m_d->currentCoordinates[ch[1]] = w2[ch[1]];
+    m_d->currentCoordinates[ch[2]] = w2[ch[2]];
+
+    m_d->widgetlist.at(0)->setHSX(m_d->currentCoordinates, true);
+    m_d->widgetlist.at(1)->setHSX(m_d->currentCoordinates, true);
+}
+
+/*------------Selector shape------------*/
+struct KisVisualColorSelectorShape::Private
+{
+    QImage gradient;
+    QImage fullSelector;
+    bool imagesNeedUpdate= true;
+    QPointF currentCoordinates;
+    Dimensions dimension;
+    ColorModel model;
+    const KoColorSpace *cs;
+    KoColor currentColor;
+    int channel1;
+    int channel2;
+    KisSignalCompressor *updateTimer;
+    KisSignalCompressor *siblingTimer;
+    bool mousePressActive = false;
+    const KoColorDisplayRendererInterface *displayRenderer = 0;
+    qreal hue = 0.0;
+    qreal sat = 0.0;
+    qreal tone = 0.0;
+
+};
+
+KisVisualColorSelectorShape::KisVisualColorSelectorShape(QWidget *parent,
+                                                         KisVisualColorSelectorShape::Dimensions dimension,
+                                                         KisVisualColorSelectorShape::ColorModel model,
+                                                         const KoColorSpace *cs,
+                                                         int channel1,
+                                                         int channel2,
+                                                         const KoColorDisplayRendererInterface *displayRenderer): QWidget(parent), m_d(new Private)
+{
+    m_d->dimension = dimension;
+    m_d->model = model;
+    m_d->cs = cs;
+    m_d->currentColor = KoColor();
+    m_d->currentColor.setOpacity(1.0);
+    m_d->currentColor.convertTo(cs);
+    int maxchannel = m_d->cs->colorChannelCount()-1;
+    m_d->channel1 = qBound(0, channel1, maxchannel);
+    m_d->channel2 = qBound(0, channel2, maxchannel);
+    this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    m_d->updateTimer = new KisSignalCompressor(100 /* ms */, KisSignalCompressor::POSTPONE, this);
+    m_d->siblingTimer = new KisSignalCompressor(30 /* ms */, KisSignalCompressor::POSTPONE, this);
+    setDisplayRenderer(displayRenderer);
+    show();
+
+}
+
+KisVisualColorSelectorShape::~KisVisualColorSelectorShape()
+{
+
+}
+
+void KisVisualColorSelectorShape::updateCursor()
+{
+    QPointF point1 = convertKoColorToShapeCoordinate(m_d->currentColor);
+    if (point1 != m_d->currentCoordinates) {
+        m_d->currentCoordinates = point1;
+    }
+}
+
+QPointF KisVisualColorSelectorShape::getCursorPosition() {
+    return m_d->currentCoordinates;
+}
+
+void KisVisualColorSelectorShape::setColor(KoColor c)
+{
+    if (c.colorSpace() != m_d->cs) {
+        c.convertTo(m_d->cs);
+    }
+    m_d->currentColor = c;
+    updateCursor();
+    m_d->imagesNeedUpdate = true;
+    update();
+}
+
+void KisVisualColorSelectorShape::setColorFromSibling(KoColor c)
+{
+    if (c.colorSpace() != m_d->cs) {
+        c.convertTo(m_d->cs);
+    }
+    m_d->currentColor = c;
+    Q_EMIT sigNewColor(c);
+    m_d->imagesNeedUpdate = true;
+    update();
+}
+
+void KisVisualColorSelectorShape::setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer)
+{
+    if (displayRenderer) {
+        if (m_d->displayRenderer) {
+            m_d->displayRenderer->disconnect(this);
+        }
+        m_d->displayRenderer = displayRenderer;
+    } else {
+        m_d->displayRenderer = KoDumbColorDisplayRenderer::instance();
+    }
+    connect(m_d->displayRenderer, SIGNAL(displayConfigurationChanged()),
+            SLOT(updateFromChangedDisplayRenderer()), Qt::UniqueConnection);
+
+}
+
+void KisVisualColorSelectorShape::updateFromChangedDisplayRenderer()
+{
+    m_d->imagesNeedUpdate = true;
+    updateCursor();
+    //m_d->currentColor = convertShapeCoordinateToKoColor(getCursorPosition());
+    update();
+}
+
+void KisVisualColorSelectorShape::forceImageUpdate()
+{
+    m_d->imagesNeedUpdate = true;
+}
+
+QColor KisVisualColorSelectorShape::getColorFromConverter(KoColor c){
+    QColor col;
+    KoColor color = c;
+    if (m_d->displayRenderer) {
+        color.convertTo(m_d->displayRenderer->getPaintingColorSpace());
+        col = m_d->displayRenderer->toQColor(c);
+    } else {
+        col = c.toQColor();
+    }
+    return col;
+}
+
+void KisVisualColorSelectorShape::slotSetActiveChannels(int channel1, int channel2)
+{
+    int maxchannel = m_d->cs->colorChannelCount()-1;
+    m_d->channel1 = qBound(0, channel1, maxchannel);
+    m_d->channel2 = qBound(0, channel2, maxchannel);
+    m_d->imagesNeedUpdate = true;
+    update();
+}
+
+QImage KisVisualColorSelectorShape::getImageMap()
+{
+    if (m_d->imagesNeedUpdate == true) {
+        m_d->imagesNeedUpdate = false;
+        m_d->gradient = QImage(width(), height(), QImage::Format_ARGB32);
+        m_d->gradient.fill(Qt::transparent);
+        QImage img(width(), height(), QImage::Format_ARGB32);
+        img.fill(Qt::transparent);
+        for (int y = 0; y<img.height(); y++) {
+            uint* data = reinterpret_cast<uint*>(img.scanLine(y));
+            for (int x=0; x<img.width(); x++,  ++data) {
+                QPoint widgetPoint(x,y);
+                QPointF newcoordinate = convertWidgetCoordinateToShapeCoordinate(widgetPoint);
+                KoColor c = convertShapeCoordinateToKoColor(newcoordinate);
+                QColor col = getColorFromConverter(c);
+                *data = col.rgba();
+            }
+        }
+
+        m_d->gradient = img;
+    }
+    return m_d->gradient;
+}
+
+KoColor KisVisualColorSelectorShape::convertShapeCoordinateToKoColor(QPointF coordinates, bool cursor)
+{
+    KoColor c = m_d->currentColor;
+    QVector <float> channelValues (c.colorSpace()->channelCount());
+    channelValues.fill(1.0);
+    c.colorSpace()->normalisedChannelsValue(c.data(), channelValues);
+    QVector <float> channelValuesDisplay = channelValues;
+    QVector <qreal> maxvalue(c.colorSpace()->channelCount());
+    maxvalue.fill(1.0);
+    if (m_d->displayRenderer
+            && (m_d->cs->colorDepthId() == Float16BitsColorDepthID
+            || m_d->cs->colorDepthId() == Float32BitsColorDepthID
+            || m_d->cs->colorDepthId() == Float64BitsColorDepthID)
+            && m_d->cs->colorModelId() != LABAColorModelID
+            && m_d->cs->colorModelId() != CMYKAColorModelID) {
+        for (int ch = 0; ch<maxvalue.size(); ch++) {
+            KoChannelInfo *channel = m_d->cs->channels()[ch];
+            maxvalue[ch] = m_d->displayRenderer->maxVisibleFloatValue(channel);
+            channelValues[ch] = channelValues[ch]/(maxvalue[ch]);
+            channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(ch, m_d->cs->channels())] = channelValues[ch];
+        }
+    } else {
+        for (int i =0; i<channelValues.size();i++) {
+            channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(i, m_d->cs->channels())] = qBound((float)0.0,channelValues[i], (float)1.0);
+        }
+    }
+    qreal huedivider = 1.0;
+    qreal huedivider2 = 1.0;
+
+    if (m_d->channel1==0) {
+        huedivider = 360.0;
+    }
+    if (m_d->channel2==0) {
+        huedivider2 = 360.0;
+    }
+    if (m_d->model != ColorModel::Channel && c.colorSpace()->colorModelId().id() == "RGBA") {
+        if (c.colorSpace()->colorModelId().id() == "RGBA") {
+            if (m_d->model == ColorModel::HSV){
+                /*
+                 * RGBToHSV has a undefined hue possibility. This means that hue will be -1.
+                 * This can be annoying for dealing with a selector, but I understand it is being
+                 * used for the KoColorSelector... For now implement a qMax here.
+                 */
+                QVector <float> inbetween(3);
+                RGBToHSV(channelValuesDisplay[0],channelValuesDisplay[1], channelValuesDisplay[2], &inbetween[0], &inbetween[1], &inbetween[2]);
+                inbetween = convertvectorqrealTofloat(getHSX(convertvectorfloatToqreal(inbetween)));
+                inbetween[m_d->channel1] = coordinates.x()*huedivider;
+                if (m_d->dimension == Dimensions::twodimensional) {
+                    inbetween[m_d->channel2] = coordinates.y()*huedivider2;
+                }
+                if (cursor==true){setHSX(convertvectorfloatToqreal(inbetween));Q_EMIT sigHSXchange();}
+                HSVToRGB(qMax(inbetween[0],(float)0.0), inbetween[1], inbetween[2], &channelValuesDisplay[0], &channelValuesDisplay[1], &channelValuesDisplay[2]);
+            } else if (m_d->model == ColorModel::HSL) {
+                /*
+                 * HSLToRGB can give negative values on the grey. I fixed the fromNormalisedChannel function to clamp,
+                 * but you might want to manually clamp for floating point values.
+                 */
+                QVector <float> inbetween(3);
+                RGBToHSL(channelValuesDisplay[0],channelValuesDisplay[1], channelValuesDisplay[2], &inbetween[0], &inbetween[1], &inbetween[2]);
+                inbetween = convertvectorqrealTofloat(getHSX(convertvectorfloatToqreal(inbetween)));
+                inbetween[m_d->channel1] = fmod(coordinates.x()*huedivider, 360.0);
+                if (m_d->dimension == Dimensions::twodimensional) {
+                    inbetween[m_d->channel2] = coordinates.y()*huedivider2;
+                }
+                if (cursor==true){setHSX(convertvectorfloatToqreal(inbetween));Q_EMIT sigHSXchange();}
+                HSLToRGB(qMax(inbetween[0],(float)0.0), inbetween[1], inbetween[2],&channelValuesDisplay[0],&channelValuesDisplay[1], &channelValuesDisplay[2]);
+            } else if (m_d->model == ColorModel::HSI) {
+                /*
+                 * HSI is a modified HSY function.
+                 */
+                QVector <qreal> chan2 = convertvectorfloatToqreal(channelValuesDisplay);
+                QVector <qreal> inbetween(3);
+                RGBToHSI(chan2[0],chan2[1], chan2[2], &inbetween[0], &inbetween[1], &inbetween[2]);
+                inbetween = getHSX(inbetween);
+                inbetween[m_d->channel1] = coordinates.x();
+                if (m_d->dimension == Dimensions::twodimensional) {
+                    inbetween[m_d->channel2] = coordinates.y();
+                }
+                if (cursor==true){setHSX(inbetween);Q_EMIT sigHSXchange();}
+                HSIToRGB(inbetween[0], inbetween[1], inbetween[2],&chan2[0],&chan2[1], &chan2[2]);
+                channelValuesDisplay = convertvectorqrealTofloat(chan2);
+            } else /*if (m_d->model == ColorModel::HSY)*/ {
+                /*
+                 * HSY is pretty slow to render due being a pretty over-the-top function.
+                 * Might be worth investigating whether HCY can be used instead, but I have had
+                 * some weird results with that.
+                 */
+                QVector <qreal> luma= m_d->cs->lumaCoefficients();
+                QVector <qreal> chan2 = convertvectorfloatToqreal(channelValuesDisplay);
+                QVector <qreal> inbetween(3);
+                RGBToHSY(chan2[0],chan2[1], chan2[2], &inbetween[0], &inbetween[1], &inbetween[2],
+                        luma[0], luma[1], luma[2]);
+                inbetween = getHSX(inbetween);
+                inbetween[m_d->channel1] = coordinates.x();
+                if (m_d->dimension == Dimensions::twodimensional) {
+                    inbetween[m_d->channel2] = coordinates.y();
+                }
+                if (cursor==true){setHSX(inbetween);Q_EMIT sigHSXchange();}
+                HSYToRGB(inbetween[0], inbetween[1], inbetween[2],&chan2[0],&chan2[1], &chan2[2],
+                        luma[0], luma[1], luma[2]);
+                channelValuesDisplay = convertvectorqrealTofloat(chan2);
+            }
+        }
+    } else {
+        channelValuesDisplay[m_d->channel1] = coordinates.x();
+        if (m_d->dimension == Dimensions::twodimensional) {
+            channelValuesDisplay[m_d->channel2] = coordinates.y();
+        }
+    }
+    for (int i=0; i<channelValues.size();i++) {
+        channelValues[i] = channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(i, m_d->cs->channels())]*(maxvalue[i]);
+    }
+    c.colorSpace()->fromNormalisedChannelsValue(c.data(), channelValues);
+    return c;
+}
+
+QPointF KisVisualColorSelectorShape::convertKoColorToShapeCoordinate(KoColor c)
+{
+    if (c.colorSpace() != m_d->cs) {
+        c.convertTo(m_d->cs);
+    }
+    QVector <float> channelValues (m_d->currentColor.colorSpace()->channelCount());
+    channelValues.fill(1.0);
+    m_d->cs->normalisedChannelsValue(c.data(), channelValues);
+    QVector <float> channelValuesDisplay = channelValues;
+    QVector <qreal> maxvalue(c.colorSpace()->channelCount());
+    maxvalue.fill(1.0);
+    if (m_d->displayRenderer
+            && (m_d->cs->colorDepthId() == Float16BitsColorDepthID
+            || m_d->cs->colorDepthId() == Float32BitsColorDepthID
+            || m_d->cs->colorDepthId() == Float64BitsColorDepthID)
+            && m_d->cs->colorModelId() != LABAColorModelID
+            && m_d->cs->colorModelId() != CMYKAColorModelID) {
+        for (int ch = 0; ch<maxvalue.size(); ch++) {
+            KoChannelInfo *channel = m_d->cs->channels()[ch];
+            maxvalue[ch] = m_d->displayRenderer->maxVisibleFloatValue(channel);
+            channelValues[ch] = channelValues[ch]/(maxvalue[ch]);
+            channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(ch, m_d->cs->channels())] = channelValues[ch];
+        }
+    } else {
+        for (int i =0; i<channelValues.size();i++) {
+            channelValuesDisplay[KoChannelInfo::displayPositionToChannelIndex(i, m_d->cs->channels())] = qBound((float)0.0,channelValues[i], (float)1.0);
+        }
+    }
+    QPointF coordinates(0.0,0.0);
+    qreal huedivider = 1.0;
+    qreal huedivider2 = 1.0;
+    if (m_d->channel1==0) {
+        huedivider = 360.0;
+    }
+    if (m_d->channel2==0) {
+        huedivider2 = 360.0;
+    }
+    if (m_d->model != ColorModel::Channel && c.colorSpace()->colorModelId().id() == "RGBA") {
+        if (c.colorSpace()->colorModelId().id() == "RGBA") {
+            if (m_d->model == ColorModel::HSV){
+                QVector <float> inbetween(3);
+                RGBToHSV(channelValuesDisplay[0],channelValuesDisplay[1], channelValuesDisplay[2], &inbetween[0], &inbetween[1], &inbetween[2]);
+                inbetween = convertvectorqrealTofloat(getHSX(convertvectorfloatToqreal(inbetween)));
+                coordinates.setX(inbetween[m_d->channel1]/huedivider);
+                if (m_d->dimension == Dimensions::twodimensional) {
+                    coordinates.setY(inbetween[m_d->channel2]/huedivider2);
+                }
+            } else if (m_d->model == ColorModel::HSL) {
+                QVector <float> inbetween(3);
+                RGBToHSL(channelValuesDisplay[0],channelValuesDisplay[1], channelValuesDisplay[2], &inbetween[0], &inbetween[1], &inbetween[2]);
+                inbetween = convertvectorqrealTofloat(getHSX(convertvectorfloatToqreal(inbetween)));
+                coordinates.setX(inbetween[m_d->channel1]/huedivider);
+                if (m_d->dimension == Dimensions::twodimensional) {
+                    coordinates.setY(inbetween[m_d->channel2]/huedivider2);
+                }
+            } else if (m_d->model == ColorModel::HSI) {
+                QVector <qreal> chan2 = convertvectorfloatToqreal(channelValuesDisplay);
+                QVector <qreal> inbetween(3);
+                RGBToHSI(channelValuesDisplay[0],channelValuesDisplay[1], channelValuesDisplay[2], &inbetween[0], &inbetween[1], &inbetween[2]);
+                inbetween = getHSX(inbetween);
+                coordinates.setX(inbetween[m_d->channel1]);
+                if (m_d->dimension == Dimensions::twodimensional) {
+                    coordinates.setY(inbetween[m_d->channel2]);
+                }
+            } else if (m_d->model == ColorModel::HSY) {
+                QVector <qreal> luma = m_d->cs->lumaCoefficients();
+                QVector <qreal> chan2 = convertvectorfloatToqreal(channelValuesDisplay);
+                QVector <qreal> inbetween(3);
+                RGBToHSY(channelValuesDisplay[0],channelValuesDisplay[1], channelValuesDisplay[2], &inbetween[0], &inbetween[1], &inbetween[2], luma[0], luma[1], luma[2]);
+                inbetween = getHSX(inbetween);
+                coordinates.setX(inbetween[m_d->channel1]);
+                if (m_d->dimension == Dimensions::twodimensional) {
+                    coordinates.setY(inbetween[m_d->channel2]);
+                }
+            }
+        }
+    } else {
+        coordinates.setX(qBound((float)0.0, channelValuesDisplay[m_d->channel1], (float)1.0));
+        if (m_d->dimension == Dimensions::twodimensional) {
+            coordinates.setY(qBound((float)0.0, channelValuesDisplay[m_d->channel2], (float)1.0));
+        }
+    }
+    return coordinates;
+}
+
+QVector<float> KisVisualColorSelectorShape::convertvectorqrealTofloat(QVector<qreal> real)
+{
+    QVector <float> vloat(real.size());
+    for (int i=0; i<real.size(); i++) {
+        vloat[i] = real[i];
+    }
+    return vloat;
+}
+
+QVector<qreal> KisVisualColorSelectorShape::convertvectorfloatToqreal(QVector <float> vloat)
+{
+    QVector <qreal> real(vloat.size());
+    for (int i=0; i<vloat.size(); i++) {
+        real[i] = vloat[i];
+    }
+    return real;
+}
+
+void KisVisualColorSelectorShape::mousePressEvent(QMouseEvent *e)
+{
+    m_d->mousePressActive = true;
+    QPointF coordinates = convertWidgetCoordinateToShapeCoordinate(e->pos());
+    KoColor col = convertShapeCoordinateToKoColor(coordinates, true);
+    setColor(col);
+    Q_EMIT sigNewColor(col);
+    m_d->updateTimer->start();
+}
+
+void KisVisualColorSelectorShape::mouseMoveEvent(QMouseEvent *e)
+{
+    if (m_d->mousePressActive==true && this->mask().contains(e->pos())) {
+        QPointF coordinates = convertWidgetCoordinateToShapeCoordinate(e->pos());
+        KoColor col = convertShapeCoordinateToKoColor(coordinates, true);
+        setColor(col);
+        if (!m_d->updateTimer->isActive()) {
+            Q_EMIT sigNewColor(col);
+            m_d->updateTimer->start();
+        }
+    } else {
+        e->ignore();
+    }
+}
+
+void KisVisualColorSelectorShape::mouseReleaseEvent(QMouseEvent *)
+{
+    m_d->mousePressActive = false;
+}
+void KisVisualColorSelectorShape::paintEvent(QPaintEvent*)
+{
+    QPainter painter(this);
+
+    //check if old and new colors differ.
+
+    if (m_d->imagesNeedUpdate) {
+        setMask(getMaskMap());
+    }
+    drawCursor();
+    painter.drawImage(0,0,m_d->fullSelector);
+}
+
+KisVisualColorSelectorShape::Dimensions KisVisualColorSelectorShape::getDimensions()
+{
+    return m_d->dimension;
+}
+
+KisVisualColorSelectorShape::ColorModel KisVisualColorSelectorShape::getColorModel()
+{
+    return m_d->model;
+}
+
+void KisVisualColorSelectorShape::setFullImage(QImage full)
+{
+    m_d->fullSelector = full;
+}
+KoColor KisVisualColorSelectorShape::getCurrentColor()
+{
+    return m_d->currentColor;
+}
+
+QVector <qreal> KisVisualColorSelectorShape::getHSX(QVector<qreal> hsx, bool wrangler)
+{
+    QVector <qreal> ihsx = hsx;
+    if (!wrangler){
+        //Ok, so this docker will not update luminosity if there's not at the least 3% more variation.
+        //This is necessary for 8bit.
+        if (m_d->cs->colorDepthId()==Integer8BitsColorDepthID){
+            if (hsx[2]>m_d->tone-0.03 && hsx[2]<m_d->tone+0.03) {
+                ihsx[2] = m_d->tone;
+            }
+        } else {
+            if (hsx[2]>m_d->tone-0.005 && hsx[2]<m_d->tone+0.005) {
+                ihsx[2] = m_d->tone;
+            }
+        }
+        if (m_d->model==HSV){
+            if (hsx[2]<=0.0) {
+                ihsx[1] = m_d->sat;
+            }
+        } else {
+            if ((hsx[2]<=0.0 || hsx[2]>=1.0)) {
+                ihsx[1] = m_d->sat;
+            }
+        }
+        if ((hsx[1]<=0.0 || hsx[0]<0.0)){
+            ihsx[0]=m_d->hue;
+        }
+    } else {
+        ihsx[0]=m_d->hue;
+        ihsx[1]=m_d->sat;
+        ihsx[2]=m_d->tone;
+    }
+    return ihsx;
+}
+
+void KisVisualColorSelectorShape::setHSX(QVector<qreal> hsx, bool wrangler)
+{
+    if (wrangler){
+        m_d->tone = hsx[2];
+        m_d->sat = hsx[1];
+        m_d->hue = hsx[0];
+    } else {
+        if (m_d->channel1==2 || m_d->channel2==2){
+            m_d->tone=hsx[2];
+        }
+        if (m_d->model==HSV){
+            if (hsx[2]>0.0) {
+                 m_d->sat = hsx[1];
+            }
+        } else {
+            if ((hsx[2]>0.0 || hsx[2]<1.0)) {
+                m_d->sat = hsx[1];
+            }
+        }
+        if ((hsx[1]>0.0 && hsx[0]>=0.0)){
+            m_d->hue = hsx[0];
+        }
+    }
+}
+
+QVector <int> KisVisualColorSelectorShape::getChannels()
+{
+    QVector <int> channels(2);
+    channels[0] = m_d->channel1;
+    channels[1] = m_d->channel2;
+    return channels;
+}
+
+/*-----------Rectangle Shape------------*/
+
+KisVisualRectangleSelectorShape::KisVisualRectangleSelectorShape(QWidget *parent,
+                                                                 Dimensions dimension,
+                                                                 ColorModel model,
+                                                                 const KoColorSpace *cs,
+                                                                 int channel1, int channel2,
+                                                                 const KoColorDisplayRendererInterface *displayRenderer,
+                                                                 int width,
+                                                                 singelDTypes d)
+    : KisVisualColorSelectorShape(parent, dimension, model, cs, channel1, channel2, displayRenderer)
+{
+    m_type = d;
+    m_barWidth = width;
+}
+
+KisVisualRectangleSelectorShape::~KisVisualRectangleSelectorShape()
+{
+
+}
+
+void KisVisualRectangleSelectorShape::setBorderWidth(int width)
+{
+    m_barWidth = width;
+}
+
+QRect KisVisualRectangleSelectorShape::getSpaceForSquare(QRect geom)
+{
+    QPointF tl;
+    QPointF br;
+
+    if (m_type==KisVisualRectangleSelectorShape::vertical) {
+        br = geom.bottomRight();
+        tl = QPoint(geom.topLeft().x()+m_barWidth, geom.topLeft().y());
+    } else if (m_type==KisVisualRectangleSelectorShape::horizontal) {
+        br = geom.bottomRight();
+        tl = QPoint(geom.topLeft().x(), geom.topLeft().y()+m_barWidth);
+    } else {
+        tl = QPointF (geom.topLeft().x()+m_barWidth, geom.topLeft().y()+m_barWidth);
+        br = QPointF (geom.bottomRight().x()-m_barWidth, geom.bottomRight().y()-m_barWidth);
+
+    }
+    QRect a(tl.toPoint(), br.toPoint());
+    QRect r(a.left(), a.top(), qMin(a.height(), a.width()), qMin(a.height(), a.width()));
+    return r;
+}
+
+QRect KisVisualRectangleSelectorShape::getSpaceForCircle(QRect geom)
+{
+    return getSpaceForSquare(geom);
+}
+
+QRect KisVisualRectangleSelectorShape::getSpaceForTriangle(QRect geom)
+{
+    return getSpaceForSquare(geom);
+}
+
+QPointF KisVisualRectangleSelectorShape::convertShapeCoordinateToWidgetCoordinate(QPointF coordinate)
+{
+    qreal x = m_barWidth/2;
+    qreal y = m_barWidth/2;
+    qreal offset = 5.0;
+    KisVisualColorSelectorShape::Dimensions dimension = getDimensions();
+    if (dimension == KisVisualColorSelectorShape::onedimensional) {
+        if ( m_type == KisVisualRectangleSelectorShape::vertical) {
+            y = qMin(coordinate.x()*(height()-offset*2)+offset, (qreal)height());
+        } else if (m_type == KisVisualRectangleSelectorShape::horizontal) {
+            x = qMin(coordinate.x()*(width()-offset*2)+offset, (qreal)width());
+        } else if (m_type == KisVisualRectangleSelectorShape::border) {
+
+            QRectF innerRect(m_barWidth/2, m_barWidth/2, width()-m_barWidth, height()-m_barWidth);
+            QPointF left (innerRect.left(),innerRect.center().y());
+            QList <QLineF> polygonLines;
+            polygonLines.append(QLineF(left, innerRect.topLeft()));
+            polygonLines.append(QLineF(innerRect.topLeft(), innerRect.topRight()));
+            polygonLines.append(QLineF(innerRect.topRight(), innerRect.bottomRight()));
+            polygonLines.append(QLineF(innerRect.bottomRight(), innerRect.bottomLeft()));
+            polygonLines.append(QLineF(innerRect.bottomLeft(), left));
+
+            qreal totalLength =0.0;
+            Q_FOREACH(QLineF line, polygonLines) {
+                totalLength += line.length();
+            }
+
+            qreal length = coordinate.x()*totalLength;
+            QPointF intersect(x,y);
+            Q_FOREACH(QLineF line, polygonLines) {
+                if (line.length()>length && length>0){
+                    intersect = line.pointAt(length/line.length());
+
+                }
+                length-=line.length();
+            }
+            x = qRound(intersect.x());
+            y = qRound(intersect.y());
+
+        } else /*if (m_type == KisVisualRectangleSelectorShape::borderMirrored)*/  {
+
+            QRectF innerRect(m_barWidth/2, m_barWidth/2, width()-m_barWidth, height()-m_barWidth);
+            QPointF bottom (innerRect.center().x(), innerRect.bottom());
+            QList <QLineF> polygonLines;
+            polygonLines.append(QLineF(bottom, innerRect.bottomLeft()));
+            polygonLines.append(QLineF(innerRect.bottomLeft(), innerRect.topLeft()));
+            polygonLines.append(QLineF(innerRect.topLeft(), innerRect.topRight()));
+            polygonLines.append(QLineF(innerRect.topRight(), innerRect.bottomRight()));
+            polygonLines.append(QLineF(innerRect.bottomRight(), bottom));
+
+            qreal totalLength =0.0;
+            Q_FOREACH(QLineF line, polygonLines) {
+                totalLength += line.length();
+            }
+
+            qreal length = coordinate.x()*(totalLength/2);
+            QPointF intersect(x,y);
+            if (coordinate.y()==1) {
+                for (int i = polygonLines.size()-1; i==0; i--) {
+                    QLineF line = polygonLines.at(i);
+                    if (line.length()>length && length>0){
+                        intersect = line.pointAt(length/line.length());
+
+                    }
+                    length-=line.length();
+                }
+            } else {
+                Q_FOREACH(QLineF line, polygonLines) {
+                    if (line.length()>length && length>0){
+                        intersect = line.pointAt(length/line.length());
+
+                    }
+                    length-=line.length();
+                }
+            }
+            x = qRound(intersect.x());
+            y = qRound(intersect.y());
+
+        }
+    } else {
+        x = qMin(coordinate.x()*(height()-offset*2)+offset, (qreal)height());
+        y = qMin(coordinate.y()*(width()-offset*2)+offset, (qreal)width());
+    }
+    return QPointF(x,y);
+}
+
+QPointF KisVisualRectangleSelectorShape::convertWidgetCoordinateToShapeCoordinate(QPoint coordinate)
+{
+    //default implementation:
+    qreal x = 0.5;
+    qreal y = 0.5;
+    qreal offset = 5.0;
+    KisVisualColorSelectorShape::Dimensions dimension = getDimensions();
+    if (getMaskMap().contains(coordinate)) {
+        if (dimension == KisVisualColorSelectorShape::onedimensional ) {
+            if (m_type == KisVisualRectangleSelectorShape::vertical) {
+                x = qMax(((qreal)coordinate.y()-offset)/((qreal)height()-offset*2), 0.0);
+            } else if (m_type == KisVisualRectangleSelectorShape::horizontal) {
+                x = qMax(((qreal)coordinate.x()-offset)/((qreal)width()-offset*2),0.0);
+            } else if (m_type == KisVisualRectangleSelectorShape::border) {
+                //border
+
+                QRectF innerRect(m_barWidth, m_barWidth, width()-(m_barWidth*2), height()-(m_barWidth*2));
+                QPointF left (innerRect.left(),innerRect.center().y());
+                QList <QLineF> polygonLines;
+                polygonLines.append(QLineF(left, innerRect.topLeft()));
+                polygonLines.append(QLineF(innerRect.topLeft(), innerRect.topRight()));
+                polygonLines.append(QLineF(innerRect.topRight(), innerRect.bottomRight()));
+                polygonLines.append(QLineF(innerRect.bottomRight(), innerRect.bottomLeft()));
+                polygonLines.append(QLineF(innerRect.bottomLeft(), left));
+
+                QLineF radius(coordinate, this->geometry().center());
+                QPointF intersect(0.5,0.5);
+                qreal length = 0.0;
+                qreal totalLength = 0.0;
+                bool foundIntersect = false;
+                Q_FOREACH(QLineF line, polygonLines) {
+                    if (line.intersect(radius,&intersect)==QLineF::BoundedIntersection && foundIntersect==false)
+                    {
+                        foundIntersect = true;
+                        length+=QLineF(line.p1(), intersect).length();
+
+                    }
+                    if (foundIntersect==false) {
+                        length+=line.length();
+                    }
+                    totalLength+=line.length();
+                }
+
+                x = length/totalLength;
+
+            } else /*if (m_type == KisVisualRectangleSelectorShape::borderMirrored)*/  {
+                //border
+
+                QRectF innerRect(m_barWidth, m_barWidth, width()-(m_barWidth*2), height()-(m_barWidth*2));
+                QPointF bottom (innerRect.center().x(), innerRect.bottom());
+                QList <QLineF> polygonLines;
+                polygonLines.append(QLineF(bottom, innerRect.bottomLeft()));
+                polygonLines.append(QLineF(innerRect.bottomLeft(), innerRect.topLeft()));
+                polygonLines.append(QLineF(innerRect.topLeft(), innerRect.topRight()));
+                polygonLines.append(QLineF(innerRect.topRight(), innerRect.bottomRight()));
+                polygonLines.append(QLineF(innerRect.bottomRight(), bottom));
+
+                QLineF radius(coordinate, this->geometry().center());
+                QPointF intersect(0.5,0.5);
+                qreal length = 0.0;
+                qreal totalLength = 0.0;
+                bool foundIntersect = false;
+                Q_FOREACH(QLineF line, polygonLines) {
+                    if (line.intersect(radius,&intersect)==QLineF::BoundedIntersection && foundIntersect==false)
+                    {
+                        foundIntersect = true;
+                        length+=QLineF(line.p1(), intersect).length();
+
+                    }
+                    if (foundIntersect==false) {
+                        length+=line.length();
+                    }
+                    totalLength+=line.length();
+                }
+                int halflength = totalLength/2;
+
+                if (length>halflength) {
+                    x = (halflength - (length-halflength))/halflength;
+                    y = 1.0;
+                } else {
+                    x = length/halflength;
+                    y = 0.0;
+                }
+            }
+        }
+        else {
+            x = qMax(((qreal)coordinate.x()-offset)/((qreal)width()-offset*2), 0.0);
+            y = qMax(((qreal)coordinate.y()-offset)/((qreal)height()-offset*2), 0.0);;
+        }
+    }
+    return QPointF(x, y);
+}
+
+QRegion KisVisualRectangleSelectorShape::getMaskMap()
+{
+    QRegion mask = QRegion(0,0,width(),height());
+    if (m_type==KisVisualRectangleSelectorShape::border || m_type==KisVisualRectangleSelectorShape::borderMirrored) {
+        mask = mask.subtracted(QRegion(m_barWidth, m_barWidth, width()-(m_barWidth*2), height()-(m_barWidth*2)));
+    }
+    return mask;
+}
+void KisVisualRectangleSelectorShape::resizeEvent(QResizeEvent *)
+{
+    forceImageUpdate();
+}
+
+void KisVisualRectangleSelectorShape::drawCursor()
+{
+    QPointF cursorPoint = convertShapeCoordinateToWidgetCoordinate(getCursorPosition());
+    QImage fullSelector = getImageMap();
+    QColor col = getColorFromConverter(getCurrentColor());
+    QPainter painter;
+    painter.begin(&fullSelector);
+    painter.setRenderHint(QPainter::Antialiasing);
+    //QPainterPath path;
+    QBrush fill;
+    fill.setStyle(Qt::SolidPattern);
+
+    int cursorwidth = 5;
+    QRect rect(cursorPoint.toPoint().x()-cursorwidth,cursorPoint.toPoint().y()-cursorwidth,
+               cursorwidth*2,cursorwidth*2);
+    if (m_type==KisVisualRectangleSelectorShape::vertical){
+        int x = ( cursorPoint.x()-(width()/2)+1 );
+        int y = ( cursorPoint.y()-cursorwidth );
+        rect.setCoords(x, y, x+width()-2, y+(cursorwidth*2));
+        painter.save();
+        painter.setCompositionMode(QPainter::CompositionMode_Clear);
+        QPen pen;
+        pen.setWidth(5);
+        painter.setPen(pen);
+        painter.drawLine(QLine(QPoint(0.0,0.0), QPoint(0.0,height())));
+        painter.drawLine(QLine(QPoint(width(),0.0), QPoint(width(),height())));
+        painter.restore();
+    } else {
+        int x = cursorPoint.x()-cursorwidth;
+        int y = cursorPoint.y()-(height()/2)+1;
+        rect.setCoords(x, y, x+(cursorwidth*2), y+cursorwidth-2);
+    }
+    QRectF innerRect(m_barWidth, m_barWidth, width()-(m_barWidth*2), height()-(m_barWidth*2));
+    if (getDimensions() == KisVisualColorSelectorShape::onedimensional && m_type!=KisVisualRectangleSelectorShape::border && m_type!=KisVisualRectangleSelectorShape::borderMirrored) {
+        painter.setPen(Qt::white);
+        fill.setColor(Qt::white);
+        painter.setBrush(fill);
+        painter.drawRect(rect);
+        //set filter conversion!
+        fill.setColor(col);
+        painter.setPen(Qt::black);
+        painter.setBrush(fill);
+        rect.setCoords(rect.topLeft().x()+1, rect.topLeft().y()+1,
+                       rect.topLeft().x()+rect.width()-2, rect.topLeft().y()+rect.height()-2);
+        painter.drawRect(rect);
+
+    }else if(m_type==KisVisualRectangleSelectorShape::borderMirrored){
+        painter.setPen(Qt::white);
+        fill.setColor(Qt::white);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth, cursorwidth);
+        QPoint mirror(innerRect.center().x()+(innerRect.center().x()-cursorPoint.x()),cursorPoint.y());
+        painter.drawEllipse(mirror, cursorwidth, cursorwidth);
+        fill.setColor(col);
+        painter.setPen(Qt::black);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth-1, cursorwidth-1);
+        painter.drawEllipse(mirror, cursorwidth-1, cursorwidth-1);
+
+    } else {
+        painter.save();
+        painter.setCompositionMode(QPainter::CompositionMode_Clear);
+        QPen pen;
+        pen.setWidth(5);
+        painter.setPen(pen);
+        painter.drawRect(QRect(0,0,width(),height()));
+        painter.restore();
+
+        painter.setPen(Qt::white);
+        fill.setColor(Qt::white);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth, cursorwidth);
+        fill.setColor(col);
+        painter.setPen(Qt::black);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth-1.0, cursorwidth-1.0);
+    }
+    painter.end();
+    setFullImage(fullSelector);
+}
+
+//----------------Elliptical--------------------------//
+KisVisualEllipticalSelectorShape::KisVisualEllipticalSelectorShape(QWidget *parent,
+                                                                 Dimensions dimension,
+                                                                 ColorModel model,
+                                                                 const KoColorSpace *cs,
+                                                                 int channel1, int channel2,
+                                                                 const KoColorDisplayRendererInterface *displayRenderer,
+                                                                 int borwidth,
+                                                                 singelDTypes d)
+    : KisVisualColorSelectorShape(parent, dimension, model, cs, channel1, channel2, displayRenderer)
+{
+    m_type = d;
+    m_barWidth = borwidth;
+}
+
+KisVisualEllipticalSelectorShape::~KisVisualEllipticalSelectorShape()
+{
+
+}
+
+QSize KisVisualEllipticalSelectorShape::sizeHint() const
+{
+    return QSize(180,180);
+}
+void KisVisualEllipticalSelectorShape::setBorderWidth(int width)
+{
+    m_barWidth = width;
+}
+
+QRect KisVisualEllipticalSelectorShape::getSpaceForSquare(QRect geom)
+{
+    int sizeValue = qMin(width(),height());
+    QRect b(geom.left(), geom.top(), sizeValue, sizeValue);
+    QLineF radius(b.center(), QPointF(b.left()+m_barWidth, b.center().y()) );
+    radius.setAngle(135);
+    QPointF tl = radius.p2();
+    radius.setAngle(315);
+    QPointF br = radius.p2();
+    QRect r(tl.toPoint(), br.toPoint());
+    return r;
+}
+
+QRect KisVisualEllipticalSelectorShape::getSpaceForCircle(QRect geom)
+{
+    int sizeValue = qMin(width(),height());
+    QRect b(geom.left(), geom.top(), sizeValue, sizeValue);
+    QPointF tl = QPointF (b.topLeft().x()+m_barWidth, b.topLeft().y()+m_barWidth);
+    QPointF br = QPointF (b.bottomRight().x()-m_barWidth, b.bottomRight().y()-m_barWidth);
+    QRect r(tl.toPoint(), br.toPoint());
+    return r;
+}
+
+QRect KisVisualEllipticalSelectorShape::getSpaceForTriangle(QRect geom)
+{
+    int sizeValue = qMin(width(),height());
+    QRect b(geom.left(), geom.top(), sizeValue, sizeValue);
+    QLineF radius(b.center(), QPointF(b.left()+m_barWidth, b.center().y()) );
+    radius.setAngle(90);//point at yellowgreen :)
+    QPointF t = radius.p2();
+    radius.setAngle(330);//point to purple :)
+    QPointF br = radius.p2();
+    radius.setAngle(210);//point to cerulean :)
+    QPointF bl = radius.p2();
+    QPointF tl = QPoint(bl.x(),t.y());
+    QRect r(tl.toPoint(), br.toPoint());
+    return r;
+}
+
+QPointF KisVisualEllipticalSelectorShape::convertShapeCoordinateToWidgetCoordinate(QPointF coordinate)
+{
+    qreal x;
+    qreal y;
+    qreal offset=7.0;
+    qreal a = (qreal)width()*0.5;
+    QPointF center(a, a);
+    QLineF line(center, QPoint((m_barWidth*0.5),a));
+    qreal angle = coordinate.x()*360.0;
+    angle = fmod(angle+180.0,360.0);
+    angle = 180.0-angle;
+    angle = angle+180.0;
+    if (m_type==KisVisualEllipticalSelectorShape::borderMirrored) {
+        angle = (coordinate.x()/2)*360.0;
+        angle = fmod((angle+90.0), 360.0);
+    }
+    line.setAngle(angle);
+    if (getDimensions()!=KisVisualColorSelectorShape::onedimensional) {
+        line.setLength(qMin(coordinate.y()*(a-offset), a-offset));
+    }
+    x = qRound(line.p2().x());
+    y = qRound(line.p2().y());
+    return QPointF(x,y);
+}
+
+QPointF KisVisualEllipticalSelectorShape::convertWidgetCoordinateToShapeCoordinate(QPoint coordinate)
+{
+    //default implementation:
+    qreal x = 0.5;
+    qreal y = 1.0;
+    qreal offset = 7.0;
+    QRect total(0, 0, width(), height());
+    QLineF line(total.center(), coordinate);
+    qreal a = (total.width()/2);
+    qreal angle;
+
+    if (m_type!=KisVisualEllipticalSelectorShape::borderMirrored){
+        angle = fmod((line.angle()+180.0), 360.0);
+        angle = 180.0-angle;
+        angle = angle+180.0;
+        x = angle/360.0;
+        if (getDimensions()==KisVisualColorSelectorShape::twodimensional) {
+            y = qBound(0.0,line.length()/(a-offset), 1.0);
+        }
+
+    } else {
+        angle = fmod((line.angle()+270.0), 360.0);
+        if (angle>180.0) {
+            angle = 180.0-angle;
+            angle = angle+180;
+        }
+        x = (angle/360.0)*2;
+        if (getDimensions()==KisVisualColorSelectorShape::twodimensional) {
+            y = qBound(0.0,(line.length()+offset)/a, 1.0);
+        }
+    }
+
+    return QPointF(x, y);
+}
+
+QRegion KisVisualEllipticalSelectorShape::getMaskMap()
+{
+    QRegion mask = QRegion(0,0,width(),height(), QRegion::Ellipse);
+    if (getDimensions()==KisVisualColorSelectorShape::onedimensional) {
+        mask = mask.subtracted(QRegion(m_barWidth, m_barWidth, width()-(m_barWidth*2), height()-(m_barWidth*2), QRegion::Ellipse));
+    }
+    return mask;
+}
+
+void KisVisualEllipticalSelectorShape::resizeEvent(QResizeEvent *)
+{
+    forceImageUpdate();
+}
+
+void KisVisualEllipticalSelectorShape::drawCursor()
+{
+    QPointF cursorPoint = convertShapeCoordinateToWidgetCoordinate(getCursorPosition());
+    QImage fullSelector = getImageMap();
+    QColor col = getColorFromConverter(getCurrentColor());
+    QPainter painter;
+    painter.begin(&fullSelector);
+    painter.setRenderHint(QPainter::Antialiasing);
+    QRect innerRect(m_barWidth, m_barWidth, width()-(m_barWidth*2), height()-(m_barWidth*2));
+
+    painter.save();
+    painter.setCompositionMode(QPainter::CompositionMode_Clear);
+    QPen pen;
+    pen.setWidth(5);
+    painter.setPen(pen);
+    painter.drawEllipse(QRect(0,0,width(),height()));
+    if (getDimensions()==KisVisualColorSelectorShape::onedimensional) {
+        painter.setBrush(Qt::SolidPattern);
+        painter.drawEllipse(innerRect);
+    }
+    painter.restore();
+
+    QBrush fill;
+    fill.setStyle(Qt::SolidPattern);
+
+    int cursorwidth = 5;
+    if(m_type==KisVisualEllipticalSelectorShape::borderMirrored){
+        painter.setPen(Qt::white);
+        fill.setColor(Qt::white);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth, cursorwidth);
+        QPoint mirror(innerRect.center().x()+(innerRect.center().x()-cursorPoint.x()),cursorPoint.y());
+        painter.drawEllipse(mirror, cursorwidth, cursorwidth);
+        fill.setColor(col);
+        painter.setPen(Qt::black);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth-1, cursorwidth-1);
+        painter.drawEllipse(mirror, cursorwidth-1, cursorwidth-1);
+
+    } else {
+        painter.setPen(Qt::white);
+        fill.setColor(Qt::white);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth, cursorwidth);
+        fill.setColor(col);
+        painter.setPen(Qt::black);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth-1.0, cursorwidth-1.0);
+    }
+    painter.end();
+    setFullImage(fullSelector);
+}
+
+//----------------Triangle--------------------------//
+KisVisualTriangleSelectorShape::KisVisualTriangleSelectorShape(QWidget *parent,
+                                                                 Dimensions dimension,
+                                                                 ColorModel model,
+                                                                 const KoColorSpace *cs,
+                                                                 int channel1, int channel2,
+                                                                 const KoColorDisplayRendererInterface *displayRenderer,
+                                                                 int borwidth)
+    : KisVisualColorSelectorShape(parent, dimension, model, cs, channel1, channel2, displayRenderer)
+{
+    m_barWidth = borwidth;
+    QRect total(0,0,width()*0.9,width()*0.9);
+    setTriangle();
+}
+
+KisVisualTriangleSelectorShape::~KisVisualTriangleSelectorShape()
+{
+
+}
+
+void KisVisualTriangleSelectorShape::setBorderWidth(int width)
+{
+    m_barWidth = width;
+}
+
+QRect KisVisualTriangleSelectorShape::getSpaceForSquare(QRect geom)
+{
+    return geom;
+}
+
+QRect KisVisualTriangleSelectorShape::getSpaceForCircle(QRect geom)
+{
+    return geom;
+}
+
+QRect KisVisualTriangleSelectorShape::getSpaceForTriangle(QRect geom)
+{
+    return geom;
+}
+void KisVisualTriangleSelectorShape::setTriangle()
+{
+    QPoint apex = QPoint (width()*0.5,0);
+    QPolygon triangle;
+    triangle<< QPoint(0,height()) << apex << QPoint(width(),height()) << QPoint(0,height());
+    m_triangle = triangle;
+    QLineF a(triangle.at(0),triangle.at(1));
+    QLineF b(triangle.at(0),triangle.at(2));
+    QLineF ap(triangle.at(2), a.pointAt(0.5));
+    QLineF bp(triangle.at(1), b.pointAt(0.5));
+    QPointF intersect;
+    ap.intersect(bp,&intersect);
+    m_center = intersect;
+    QLineF r(triangle.at(0), intersect);
+    m_radius = r.length();
+}
+
+QPointF KisVisualTriangleSelectorShape::convertShapeCoordinateToWidgetCoordinate(QPointF coordinate)
+{
+    qreal offset=7.0;//the offset is so we get a nice little border that allows selecting extreme colors better.
+    qreal y = qMin(coordinate.y()*(height()-offset*2)+offset+5.0, (qreal)height()-offset);
+
+    qreal triWidth = width();
+    qreal horizontalLineLength = y*(2./sqrt(3.));
+    qreal horizontalLineStart = triWidth/2.-horizontalLineLength/2.;
+    qreal relativeX = coordinate.x()*(horizontalLineLength-offset*2);
+    qreal x = qMin(relativeX + horizontalLineStart + offset, (qreal)width()-offset*2);
+    if (y<offset){
+        x = 0.5*width();
+    }
+
+    return QPointF(x,y);
+}
+
+QPointF KisVisualTriangleSelectorShape::convertWidgetCoordinateToShapeCoordinate(QPoint coordinate)
+{
+    //default implementation: gotten from the kotrianglecolorselector/kis_color_selector_triangle.
+    qreal x = 0.5;
+    qreal y = 0.5;
+    qreal offset=7.0; //the offset is so we get a nice little border that allows selecting extreme colors better.
+
+    y = qMax((qreal)coordinate.y()-offset,0.0)/(height()-offset*2);
+
+    qreal triWidth = width();
+    qreal horizontalLineLength = ((qreal)coordinate.y())*(2./sqrt(3.))-(offset*2);
+    qreal horizontalLineStart = (triWidth*0.5)-(horizontalLineLength*0.5);
+
+    qreal relativeX = qMax((qreal)coordinate.x(),0.0)-horizontalLineStart;
+    x = relativeX/horizontalLineLength;
+    if (coordinate.y()<offset){
+        x = 0.5;
+    }
+    return QPointF(x, y);
+}
+
+QRegion KisVisualTriangleSelectorShape::getMaskMap()
+{
+    QRegion mask = QRegion(m_triangle);
+    //QRegion mask =  QRegion();
+    //if (getDimensions()==KisVisualColorSelectorShape::onedimensional) {
+    //    mask = mask.subtracted(QRegion(m_barWidth, m_barWidth, width()-(m_barWidth*2), height()-(m_barWidth*2)));
+    //}
+    return mask;
+}
+
+void KisVisualTriangleSelectorShape::resizeEvent(QResizeEvent *)
+{
+    setTriangle();
+    forceImageUpdate();
+}
+
+void KisVisualTriangleSelectorShape::drawCursor()
+{
+    QPointF cursorPoint = convertShapeCoordinateToWidgetCoordinate(getCursorPosition());
+    QImage fullSelector = getImageMap();
+    QColor col = getColorFromConverter(getCurrentColor());
+    QPainter painter;
+    painter.begin(&fullSelector);
+    painter.setRenderHint(QPainter::Antialiasing);
+
+    painter.save();
+    painter.setCompositionMode(QPainter::CompositionMode_Clear);
+    QPen pen;
+    pen.setWidth(10);
+    painter.setPen(pen);
+    painter.drawPolygon(m_triangle);
+    painter.restore();
+
+    //QPainterPath path;
+    QBrush fill;
+    fill.setStyle(Qt::SolidPattern);
+
+    int cursorwidth = 5;
+    QRect innerRect(m_barWidth, m_barWidth, width()-(m_barWidth*2), height()-(m_barWidth*2));
+    /*if(m_type==KisVisualTriangleSelectorShape::borderMirrored){
+        painter.setPen(Qt::white);
+        fill.setColor(Qt::white);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth, cursorwidth);
+        QPoint mirror(innerRect.center().x()+(innerRect.center().x()-cursorPoint.x()),cursorPoint.y());
+        painter.drawEllipse(mirror, cursorwidth, cursorwidth);
+        fill.setColor(col);
+        painter.setPen(Qt::black);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth-1, cursorwidth-1);
+        painter.drawEllipse(mirror, cursorwidth-1, cursorwidth-1);
+
+    } else {*/
+        painter.setPen(Qt::white);
+        fill.setColor(Qt::white);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth, cursorwidth);
+        fill.setColor(col);
+        painter.setPen(Qt::black);
+        painter.setBrush(fill);
+        painter.drawEllipse(cursorPoint, cursorwidth-1.0, cursorwidth-1.0);
+    //}
+    painter.end();
+    setFullImage(fullSelector);
+}
diff --git a/libs/ui/widgets/kis_visual_color_selector.h b/libs/ui/widgets/kis_visual_color_selector.h
new file mode 100644
index 0000000..e43448a
--- /dev/null
+++ b/libs/ui/widgets/kis_visual_color_selector.h
@@ -0,0 +1,447 @@
+/*
+ * Copyright (C) Wolthera van Hovell tot Westerflier <griffinvalley at gmail.com>, (C) 2016
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KISVISUALCOLORSELECTOR_H
+#define KISVISUALCOLORSELECTOR_H
+
+#include <QWidget>
+#include <QScopedPointer>
+#include <QPixmap>
+#include <QRegion>
+#include <QMouseEvent>
+
+#include <KoColor.h>
+#include <KoColorSpace.h>
+#include "KoColorDisplayRendererInterface.h"
+
+
+#include "kritaui_export.h"
+
+/**
+ * @brief The KisVisualColorSelector class
+ * this gives a color selector box that draws gradients and everything.
+ * Unlike other color selectors, this one draws the full gamut of the given colorspace.
+ */
+class KRITAUI_EXPORT KisVisualColorSelector : public QWidget
+{
+    Q_OBJECT
+public:
+    //Copied directly from the advanced color selector:
+    enum Type {Ring, Square, Wheel, Triangle, Slider};
+    enum Parameters {H, hsvS, V, hslS, L, SL, SV, SV2, hsvSH, hslSH, VH, LH, SI, SY, hsiSH, hsySH, I, Y, IH, YH, hsiS, hsyS};
+    struct Configuration {
+        Type mainType;
+        Type subType;
+        Parameters mainTypeParameter;
+        Parameters subTypeParameter;
+        Configuration(Type mainT = Triangle,
+                              Type subT = Ring,
+                              Parameters mainTP = SL,
+                              Parameters subTP = H)
+                                  : mainType(mainT),
+                                  subType(subT),
+                                  mainTypeParameter(mainTP),
+                                  subTypeParameter(subTP)
+        {}
+        Configuration(QString string)
+        {
+            readString(string);
+        }
+
+        QString toString() const
+        {
+            return QString("%1|%2|%3|%4").arg(mainType).arg(subType).arg(mainTypeParameter).arg(subTypeParameter);
+        }
+        void readString(QString string)
+        {
+            QStringList strili = string.split('|');
+            if(strili.length()!=4) return;
+
+            int imt=strili.at(0).toInt();
+            int ist=strili.at(1).toInt();
+            int imtp=strili.at(2).toInt();
+            int istp=strili.at(3).toInt();
+
+            if(imt>Slider || ist>Slider || imtp>hsyS || istp>hsyS)//this was LH before
+                return;
+
+            mainType = Type(imt);
+            subType = Type(ist);
+            mainTypeParameter = Parameters(imtp);
+            subTypeParameter = Parameters(istp);
+        }
+        static Configuration fromString(QString string)
+        {
+            Configuration ret;
+            ret.readString(string);
+            return ret;
+        }
+    };
+
+    explicit KisVisualColorSelector(QWidget *parent = 0);
+    ~KisVisualColorSelector();
+
+    /**
+     * @brief setConfig
+     * @param forceCircular
+     * Force circular is for space where you only have room for a circular selector.
+     * @param forceSelfUpdate
+     * force self-update is for making it update itself when using a modal dialog.
+     */
+    void setConfig(bool forceCircular, bool forceSelfUpdate);
+    KoColor getCurrentColor();
+
+Q_SIGNALS:
+    void sigNewColor(KoColor c);
+
+public Q_SLOTS:
+
+    void slotSetColor(KoColor c);
+    void slotsetColorSpace(const KoColorSpace *cs);
+    void slotRebuildSelectors();
+    void ConfigurationChanged();
+    void setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer);
+private Q_SLOTS:
+    void updateFromWidgets(KoColor c);
+    void HSXwrangler();
+protected:
+    void leaveEvent(QEvent *);
+    void resizeEvent(QResizeEvent *);
+private:
+    struct Private;
+    const QScopedPointer<Private> m_d;
+
+    void updateSelectorElements(QObject *source);
+    void drawGradients();
+
+};
+
+//kis_visual_color_selector_shape
+
+/**
+ * @brief The KisVisualColorSelectorShape class
+ * A 2d widget can represent at maximum 2 coordinates.
+ * So first decide howmany coordinates you need. (onedimensional, or twodimensional)
+ * Then the model, (Channel, HSV, HSL, HSI, YUV). Channel is the raw color channels.
+ * When it finds a non-implemented feature it'll return to Channel.
+ * Then, select the channels you wish to be affected. This uses the model, so for cmyk
+ * the channel is c=0, m=1, y=2, k=3, but for hsv, hue=0, sat=1, and val=2
+ * These can also be set with 'slotsetactive channels'.
+ * Then finally, connect the displayrenderer, you can also do this with 'setdisplayrenderer'
+ *
+ * Either way, this class is made to be subclassed, with a few virtuals so that the geometry
+ * can be calculated properly.
+ */
+
+class KisVisualColorSelectorShape : public QWidget
+{
+    Q_OBJECT
+public:
+    /**
+     * @brief The Dimensions enum
+     * Wether or not the shape is single or two dimensional.
+     **/
+    enum Dimensions{onedimensional, twodimensional};
+    enum ColorModel{Channel, HSV, HSL, HSI, HSY, YUV};
+    explicit KisVisualColorSelectorShape(QWidget *parent,
+                                         KisVisualColorSelectorShape::Dimensions dimension,
+                                         KisVisualColorSelectorShape::ColorModel model,
+                                         const KoColorSpace *cs,
+                                         int channel1, int channel2,
+                                         const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance());
+    ~KisVisualColorSelectorShape();
+
+    /**
+     * @brief getCursorPosition
+     * @return current cursor position in shape-coordinates.
+     */
+    QPointF getCursorPosition();
+    /**
+     * @brief getDimensions
+     * @return whether this is a single or twodimensional widget.
+     */
+    Dimensions getDimensions();
+    /**
+     * @brief getColorModel
+     * @return the model of this widget.
+     */
+    ColorModel getColorModel();
+    /**
+     * @brief getPixmap
+     * @return the pixmap of the gradient, for drawing on with a subclass.
+     * the pixmap will not change unless 'm_d->setPixmap=true' which is toggled by
+     * refresh and update functions.
+     */
+    QImage getImageMap();
+    /**
+     * @brief setFullImage
+     * Set the full widget image to be painted.
+     * @param full this should be the full image.
+     */
+    void setFullImage(QImage full);
+    /**
+     * @brief getCurrentColor
+     * @return the current kocolor
+     */
+    KoColor getCurrentColor();
+    /**
+     * @brief setDisplayRenderer
+     * disconnect the old display renderer if needed and connect the new one.
+     * @param displayRenderer
+     */
+    void setDisplayRenderer (const KoColorDisplayRendererInterface *displayRenderer);
+    /**
+     * @brief getColorFromConverter
+     * @param c a koColor.
+     * @return get the qcolor from the given kocolorusing this widget's display renderer.
+     */
+    QColor getColorFromConverter(KoColor c);
+
+    /**
+     * @brief getSpaceForSquare
+     * @param geom the full widget rectangle
+     * @return rectangle with enough space for second widget
+     */
+    virtual QRect getSpaceForSquare(QRect geom) = 0;
+    virtual QRect getSpaceForCircle(QRect geom) = 0;
+    virtual QRect getSpaceForTriangle(QRect geom) = 0;
+
+    /**
+     * @brief forceImageUpdate
+     * force the image to recache.
+     */
+    void forceImageUpdate();
+
+    /**
+     * @brief setBorderWidth
+     * set the border of the single dimensional selector.
+     * @param width
+     */
+    virtual void setBorderWidth(int width) = 0;
+
+    /**
+     * @brief getChannels
+     * get used channels
+     * @return
+     */
+    QVector <int> getChannels();
+
+    /**
+     * @brief setHSX
+     * This is for the cursor not to change when selecting
+     * black, white, and desaturated values. Will not change the non-native values.
+     * @param hsx the hsx value.
+     */
+    void setHSX(QVector <qreal> hsx, bool wrangler=false);
+    /**
+     * @brief getHSX sets the sat and hue so they won't
+     * switch around much.
+     * @param hsx the hsx values.
+     * @return returns hsx, corrected.
+     */
+    QVector <qreal> getHSX(QVector <qreal> hsx, bool wrangler= false);
+
+
+Q_SIGNALS:
+    void sigNewColor(KoColor col);
+    void sigHSXchange();
+
+public Q_SLOTS:
+    /**
+     * @brief setColor
+     * Set this widget's current color and change the cursor position.
+     * @param c
+     */
+    void setColor(KoColor c);
+    /**
+     * @brief setColorFromSibling
+     * set this widget's current color, but don't change the cursor position,
+     * instead sent out a signal of the new color.
+     * @param c
+     */
+    void setColorFromSibling(KoColor c);
+    /**
+     * @brief slotSetActiveChannels
+     * Change the active channels if necessary.
+     * @param channel1 used by single and twodimensional widgets.
+     * @param channel2 only used by twodimensional widgets.
+     */
+    void slotSetActiveChannels(int channel1, int channel2);
+    /**
+     * @brief updateFromChangedDisplayRenderer
+     * for updating from the display renderer... not sure why this one is public.
+     */
+    void updateFromChangedDisplayRenderer();
+protected:
+    void mousePressEvent(QMouseEvent *e);
+    void mouseMoveEvent(QMouseEvent *e);
+    void mouseReleaseEvent(QMouseEvent *e);
+    void paintEvent(QPaintEvent*);
+private:
+    struct Private;
+    const QScopedPointer<Private> m_d;
+
+    /**
+     * @brief convertShapeCoordinateToWidgetCoordinate
+     * @return take the position in the shape and convert it to screen coordinates.
+     */
+    virtual QPointF convertShapeCoordinateToWidgetCoordinate(QPointF) = 0;
+
+    /**
+     * @brief convertWidgetCoordinateToShapeCoordinate
+     * Convert a coordinate in the widget's height/width to a shape coordinate.
+     * @param coordinate the position your wish to have the shape coordinates of.
+     */
+    virtual QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate) = 0;
+
+    /**
+     * @brief updateCursor
+     * Update the cursor position.
+     */
+    void updateCursor();
+
+    QPointF convertKoColorToShapeCoordinate(KoColor c);
+    KoColor convertShapeCoordinateToKoColor(QPointF coordinates, bool cursor=false);
+
+    /**
+     * @brief getPixmap
+     * @return the pixmap of this shape.
+     */
+    virtual QRegion getMaskMap() = 0;
+    virtual void drawCursor() = 0;
+
+    QVector <float> convertvectorqrealTofloat(QVector<qreal> real);
+    QVector <qreal> convertvectorfloatToqreal(QVector <float> vloat);
+};
+
+class KisVisualRectangleSelectorShape : public KisVisualColorSelectorShape
+{
+    Q_OBJECT
+public:
+    enum singelDTypes{vertical, horizontal, border, borderMirrored};
+    explicit KisVisualRectangleSelectorShape(QWidget *parent,
+                                         Dimensions dimension,
+                                         ColorModel model,
+                                         const KoColorSpace *cs,
+                                         int channel1, int channel2,
+                                         const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(), int width=20,
+                                         KisVisualRectangleSelectorShape::singelDTypes d = KisVisualRectangleSelectorShape::vertical
+                                         );
+    ~KisVisualRectangleSelectorShape();
+
+    void setBorderWidth(int width);
+
+    /**
+     * @brief getSpaceForSquare
+     * @param geom the full widget rectangle
+     * @return rectangle with enough space for second widget
+     */
+    virtual QRect getSpaceForSquare(QRect geom);
+    virtual QRect getSpaceForCircle(QRect geom);
+    virtual QRect getSpaceForTriangle(QRect geom);
+protected:
+    void resizeEvent(QResizeEvent *);
+private:
+    virtual QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate);
+    virtual QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate);
+
+    singelDTypes m_type;
+    int m_barWidth;
+    virtual QRegion getMaskMap();
+    virtual void drawCursor();
+};
+
+class KisVisualEllipticalSelectorShape : public KisVisualColorSelectorShape
+{
+    Q_OBJECT
+public:
+    enum singelDTypes{border, borderMirrored};
+    explicit KisVisualEllipticalSelectorShape(QWidget *parent,
+                                         Dimensions dimension,
+                                         ColorModel model,
+                                         const KoColorSpace *cs,
+                                         int channel1, int channel2,
+                                         const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(), int borwidth=20,
+                                         KisVisualEllipticalSelectorShape::singelDTypes d = KisVisualEllipticalSelectorShape::border
+                                         );
+    ~KisVisualEllipticalSelectorShape();
+
+    void setBorderWidth(int width);
+
+    /**
+     * @brief getSpaceForSquare
+     * @param geom the full widget rectangle
+     * @return rectangle with enough space for second widget
+     */
+    virtual QRect getSpaceForSquare(QRect geom);
+    virtual QRect getSpaceForCircle(QRect geom);
+    virtual QRect getSpaceForTriangle(QRect geom);
+protected:
+    void resizeEvent(QResizeEvent *);
+private:
+    virtual QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate);
+    virtual QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate);
+
+
+    singelDTypes m_type;
+    int m_barWidth;
+    virtual QRegion getMaskMap();
+    virtual void drawCursor();
+    QSize sizeHint() const;
+};
+
+class KisVisualTriangleSelectorShape : public KisVisualColorSelectorShape
+{
+    Q_OBJECT
+public:
+    enum singelDTypes{border, borderMirrored};
+    explicit KisVisualTriangleSelectorShape(QWidget *parent,
+                                         Dimensions dimension,
+                                         ColorModel model,
+                                         const KoColorSpace *cs,
+                                         int channel1, int channel2,
+                                         const KoColorDisplayRendererInterface *displayRenderer = KoDumbColorDisplayRenderer::instance(),
+                                         int borwidth=20
+                                         );
+    ~KisVisualTriangleSelectorShape();
+
+    void setBorderWidth(int width);
+    void setTriangle();
+
+    /**
+     * @brief getSpaceForSquare
+     * @param geom the full widget rectangle
+     * @return rectangle with enough space for second widget
+     */
+    virtual QRect getSpaceForSquare(QRect geom);
+    virtual QRect getSpaceForCircle(QRect geom);
+    virtual QRect getSpaceForTriangle(QRect geom);
+protected:
+    void resizeEvent(QResizeEvent *);
+private:
+    virtual QPointF convertShapeCoordinateToWidgetCoordinate(QPointF coordinate);
+    virtual QPointF convertWidgetCoordinateToShapeCoordinate(QPoint coordinate);
+
+    singelDTypes m_type;
+    int m_barWidth;
+    QPolygon m_triangle;
+    QPointF m_center;
+    qreal m_radius;
+    virtual QRegion getMaskMap();
+    virtual void drawCursor();
+};
+#endif // KISVISUALCOLORSELECTOR_H
diff --git a/libs/widgets/CMakeLists.txt b/libs/widgets/CMakeLists.txt
index c141267..6d53be6 100644
--- a/libs/widgets/CMakeLists.txt
+++ b/libs/widgets/CMakeLists.txt
@@ -31,7 +31,6 @@ set(kritawidgets_LIB_SRCS
     KoColorPopupAction.cpp
     KoColorSetWidget.cpp
     KoColorSlider.cpp
-    KoDualColorButton.cpp
     KoEditColorSetDialog.cpp
     KoTriangleColorSelector.cpp
     KoResourcePopupAction.cpp
diff --git a/libs/widgets/KoColorPatch.cpp b/libs/widgets/KoColorPatch.cpp
index 6b00068..0d2b534 100644
--- a/libs/widgets/KoColorPatch.cpp
+++ b/libs/widgets/KoColorPatch.cpp
@@ -22,6 +22,9 @@
 
 KoColorPatch::KoColorPatch( QWidget *parent ) : QFrame( parent )
 {
+    m_displayRenderer = KoDumbColorDisplayRenderer::instance();
+    connect(m_displayRenderer, SIGNAL(displayConfigurationChanged()),
+            SLOT(update()), Qt::UniqueConnection);
     setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
 }
 
@@ -40,6 +43,32 @@ void KoColorPatch::setColor(const KoColor& c)
 
     update();
 }
+void KoColorPatch::setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer)
+{
+    if (displayRenderer) {
+        if (m_displayRenderer) {
+            m_displayRenderer->disconnect(this);
+        }
+        m_displayRenderer = displayRenderer;
+    } else {
+        m_displayRenderer = KoDumbColorDisplayRenderer::instance();
+    }
+    connect(m_displayRenderer, SIGNAL(displayConfigurationChanged()),
+            SLOT(update()), Qt::UniqueConnection);
+
+}
+
+QColor KoColorPatch::getColorFromDisplayRenderer(KoColor c)
+{
+    QColor col;
+    if (m_displayRenderer) {
+        c.convertTo(m_displayRenderer->getPaintingColorSpace());
+        col = m_displayRenderer->toQColor(c);
+    } else {
+        col = c.toQColor();
+    }
+    return col;
+}
 
 KoColor KoColorPatch::color() const
 {
@@ -55,9 +84,7 @@ void KoColorPatch::mousePressEvent (QMouseEvent *e )
 
 void KoColorPatch::paintEvent(QPaintEvent *pe)
 {
-    QColor qc;
-    m_color.toQColor(&qc);
-
+    QColor qc = getColorFromDisplayRenderer(m_color);
     QFrame::paintEvent(pe);
     QPainter painter( this );
     painter.setPen(qc);
diff --git a/libs/widgets/KoColorPatch.h b/libs/widgets/KoColorPatch.h
index c30b72f..fd3ead4 100644
--- a/libs/widgets/KoColorPatch.h
+++ b/libs/widgets/KoColorPatch.h
@@ -23,6 +23,7 @@
 
 #include <KoColor.h>
 #include "kritawidgets_export.h"
+#include <KoColorDisplayRendererInterface.h>
 
 /**
  *  The small widget showing the selected color
@@ -41,6 +42,20 @@ public:
     void setColor( const KoColor &c );
 
     /**
+     * @brief setDisplayRenderer
+     * Set the display renderer of this object.
+     * @param displayRenderer
+     */
+    void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer);
+
+    /**
+     * @brief getColorFromDisplayRenderer
+     * Get QColor from the display renderers
+     * @param c
+     */
+    QColor getColorFromDisplayRenderer(KoColor c);
+
+    /**
      * @return current color shown by this patch
      */
     KoColor color() const;
@@ -60,6 +75,7 @@ Q_SIGNALS:
 
 private:
   KoColor m_color;
+  const KoColorDisplayRendererInterface *m_displayRenderer;
 };
 
 #endif
diff --git a/libs/widgets/KoColorSetWidget.cpp b/libs/widgets/KoColorSetWidget.cpp
index 5a5307c..c8e9758 100644
--- a/libs/widgets/KoColorSetWidget.cpp
+++ b/libs/widgets/KoColorSetWidget.cpp
@@ -53,10 +53,19 @@ void KoColorSetWidget::KoColorSetWidgetPrivate::fillColors()
     colorSetLayout->setMargin(3);
     colorSetLayout->setSpacing(0); // otherwise the use can click where there is none
     colorSetContainer->setBackgroundRole(QPalette::Dark);
-    for(int i = 0; i<16; i++) {
+
+    int columns = 16;
+    if (colorSet) {
+        columns = colorSet->columnCount();
+    }
+    for(int i = 0; i<columns; i++) {
         colorSetLayout->setColumnMinimumWidth(i, 12);
     }
+    colorSetContainer->setMinimumWidth(columns*12+6);
     colorSetContainer->setLayout(colorSetLayout);
+    patchWidgetList.clear();
+    colornames.clear();
+    colorNameCmb->clear();
 
     if (colorSet) {
         for( int i = 0, p= 0; i < colorSet->nColors(); i++) {
@@ -64,13 +73,21 @@ void KoColorSetWidget::KoColorSetWidgetPrivate::fillColors()
             patch->setFrameStyle(QFrame::Plain | QFrame::Box);
             patch->setLineWidth(1);
             patch->setColor(colorSet->getColor(i).color);
+            patch->setToolTip(colorSet->getColor(i).name);
             connect(patch, SIGNAL(triggered(KoColorPatch *)), thePublic, SLOT(colorTriggered(KoColorPatch *)));
-            colorSetLayout->addWidget(patch, p/16, p%16);
+            colorSetLayout->addWidget(patch, p/columns, p%columns);
+            patch->setDisplayRenderer(displayRenderer);
+            patchWidgetList.append(patch);
+            colornames.append(colorSet->getColor(i).name);
+            QPixmap colorsquare = QPixmap(12,12);
+            colorsquare.fill(colorSet->getColor(i).color.toQColor());
+            colorNameCmb->addItem(QIcon(colorsquare), colorSet->getColor(i).name);
             ++p;
         }
     }
 
     scrollArea->setWidget(colorSetContainer);
+    connect(colorNameCmb, SIGNAL(activated(QString)), thePublic, SLOT(setColorFromString(QString)), Qt::UniqueConnection);
 }
 
 void KoColorSetWidget::KoColorSetWidgetPrivate::addRemoveColors()
@@ -114,7 +131,8 @@ void KoColorSetWidget::KoColorSetWidgetPrivate::addRecent(const KoColor &color)
 {
     if(numRecents<6) {
         recentPatches[numRecents] = new KoColorPatch(thePublic);
-        recentPatches[numRecents]->setFrameShape(QFrame::Box);
+        recentPatches[numRecents]->setFrameShape(QFrame::StyledPanel);
+        recentPatches[numRecents]->setDisplayRenderer(displayRenderer);
         recentsLayout->insertWidget(numRecents+1, recentPatches[numRecents]);
         connect(recentPatches[numRecents], SIGNAL(triggered(KoColorPatch *)), thePublic, SLOT(colorTriggered(KoColorPatch *)));
         numRecents++;
@@ -168,8 +186,13 @@ KoColorSetWidget::KoColorSetWidget(QWidget *parent)
     d->scrollArea = new QScrollArea();
     d->scrollArea->setBackgroundRole(QPalette::Dark);
     d->mainLayout->addWidget(d->scrollArea);
+    d->colorNameCmb = new QComboBox(this);
+    d->colorNameCmb->setEditable(true);
+    d->colorNameCmb->setInsertPolicy(QComboBox::NoInsert);
+    d->mainLayout->addWidget(d->colorNameCmb);
     d->fillColors();
 
+
     d->addRemoveButton = new QToolButton(this);
     d->addRemoveButton->setText(i18n("Add / Remove Colors..."));
     d->addRemoveButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
@@ -199,6 +222,8 @@ void KoColorSetWidget::KoColorSetWidgetPrivate::colorTriggered(KoColorPatch *pat
 
     emit thePublic->colorChanged(patch->color(), true);
 
+    colorNameCmb->setCurrentIndex(colornames.indexOf(QRegExp(patch->toolTip()+"|Fixed")));
+
     for(i = 0; i <numRecents; i++)
         if(patch == recentPatches[i]) {
             activateRecent(i);
@@ -209,6 +234,13 @@ void KoColorSetWidget::KoColorSetWidgetPrivate::colorTriggered(KoColorPatch *pat
         addRecent(patch->color());
 }
 
+void KoColorSetWidget::KoColorSetWidgetPrivate::setColorFromString(QString s)
+{
+    int i = colornames.indexOf(QRegExp(s+"|Fixed"));
+    i = qMax(i,0);
+    colorTriggered(patchWidgetList.at(i));
+}
+
 void KoColorSetWidget::setColorSet(KoColorSet *colorSet)
 {
     if (colorSet == d->colorSet) return;
@@ -228,6 +260,21 @@ KoColorSet* KoColorSetWidget::colorSet()
     return d->colorSet;
 }
 
+void KoColorSetWidget::setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer)
+{
+    if (displayRenderer) {
+        d->displayRenderer = displayRenderer;
+        Q_FOREACH(KoColorPatch *p, d->patchWidgetList) {
+            p->setDisplayRenderer(displayRenderer);
+        }
+        for (int i=0; i<6; i++) {
+            if (d->recentPatches[i]) {
+                d->recentPatches[i]->setDisplayRenderer(displayRenderer);
+            }
+        }
+    }
+}
+
 void KoColorSetWidget::resizeEvent(QResizeEvent *event)
 {
     emit widgetSizeChanged(event->size());
diff --git a/libs/widgets/KoColorSetWidget.h b/libs/widgets/KoColorSetWidget.h
index 07dbe26..6a26963 100644
--- a/libs/widgets/KoColorSetWidget.h
+++ b/libs/widgets/KoColorSetWidget.h
@@ -25,6 +25,7 @@
 #include <QFrame>
 
 #include "kritawidgets_export.h"
+#include <KoColorDisplayRendererInterface.h>
 
 class KoColor;
 class KoColorSet;
@@ -61,6 +62,13 @@ public:
     void setColorSet(KoColorSet *colorSet);
     
     /**
+     * @brief setDisplayRenderer
+     * Set the display renderer of this object.
+     * @param displayRenderer
+     */
+    void setDisplayRenderer(const KoColorDisplayRendererInterface *displayRenderer);
+
+    /**
      * Gets the current color set
      * @returns current color set,, 0 if none set
      */
@@ -90,6 +98,7 @@ Q_SIGNALS:
 private:
     Q_PRIVATE_SLOT(d, void colorTriggered(KoColorPatch *))
     Q_PRIVATE_SLOT(d, void addRemoveColors())
+    Q_PRIVATE_SLOT(d, void setColorFromString(QString s))
 
     class KoColorSetWidgetPrivate;
     KoColorSetWidgetPrivate * const d;
diff --git a/libs/widgets/KoColorSetWidget_p.h b/libs/widgets/KoColorSetWidget_p.h
index 0a85e98..867dadf 100644
--- a/libs/widgets/KoColorSetWidget_p.h
+++ b/libs/widgets/KoColorSetWidget_p.h
@@ -36,11 +36,13 @@
 #include <QDir>
 #include <QPointer>
 #include <QScrollArea>
+#include <QComboBox>
 
 #include <klocalizedstring.h>
 #include <WidgetsDebug.h>
 
 #include <resources/KoColorSet.h>
+#include <KoColorDisplayRendererInterface.h>
 
 class KoColorPatch;
 
@@ -57,6 +59,8 @@ public:
     QHBoxLayout *recentsLayout;
     KoColorPatch *recentPatches[6];
     QToolButton *addRemoveButton;
+    QComboBox *colorNameCmb;
+    QStringList colornames;
     int numRecents;
 
     void colorTriggered(KoColorPatch *patch);
@@ -64,6 +68,11 @@ public:
     void activateRecent(int i);
     void fillColors();
     void addRemoveColors();
+    void setColorFromString(QString s);
+
+    QList<KoColorPatch*> patchWidgetList;
+    const KoColorDisplayRendererInterface *displayRenderer;
+
 };
 
 #endif
diff --git a/libs/widgets/KoEditColorSetDialog.cpp b/libs/widgets/KoEditColorSetDialog.cpp
index c76eead..b5e8e6f 100644
--- a/libs/widgets/KoEditColorSetDialog.cpp
+++ b/libs/widgets/KoEditColorSetDialog.cpp
@@ -71,7 +71,14 @@ KoEditColorSetWidget::KoEditColorSetWidget(const QList<KoColorSet *> &palettes,
         index = widget.selector->findText(m_activeColorSet->name());
     }
 
-    m_scrollArea->setMinimumWidth(16*(12+2));
+    int columns = 16;
+    if(m_activeColorSet) {
+        columns = m_activeColorSet->columnCount();
+        if (columns==0){
+            columns = 16;
+        }
+    }
+    m_scrollArea->setMinimumWidth(columns*(12+2));
 
     QHBoxLayout *layout = new QHBoxLayout();
     layout->setContentsMargins(0, 0, 0, 0);
@@ -121,15 +128,20 @@ void KoEditColorSetWidget::setActiveColorSet(int index)
 
     m_activeColorSet = m_colorSets.value(index);
     setEnabled(m_activeColorSet != 0);
+    int columns = 16;
     if (m_activeColorSet) {
+        columns = m_activeColorSet->columnCount();
+        if (columns==0){columns=16;}
         widget.remove->setEnabled(false);
         for (int i = 0; i < m_activeColorSet->nColors(); i++) {
             KoColorPatch *patch = new KoColorPatch(widget.patchesFrame);
             patch->setColor(m_activeColorSet->getColor(i).color);
+            patch->setToolTip(m_activeColorSet->getColor(i).name);
             connect(patch, SIGNAL(triggered(KoColorPatch *)), this, SLOT(setTextLabel(KoColorPatch *)));
-            m_gridLayout->addWidget(patch, i/16, i%16);
+            m_gridLayout->addWidget(patch, i/columns, i%columns);
         }
     }
+    m_scrollArea->setMinimumWidth(columns*(12+2));
 
     wdg->setLayout(m_gridLayout);
     m_scrollArea->setWidget(wdg);
@@ -137,7 +149,7 @@ void KoEditColorSetWidget::setActiveColorSet(int index)
 
 void KoEditColorSetWidget::setTextLabel(KoColorPatch *patch)
 {
-    widget.colorName->setText(patch->color().toQColor().name());
+    widget.colorName->setText(patch->toolTip());
     if (m_activePatch) {
         m_activePatch->setFrameShape(QFrame::NoFrame);
         m_activePatch->setFrameShadow(QFrame::Plain);
@@ -159,10 +171,11 @@ void KoEditColorSetWidget::addColor()
         newEntry.name = QInputDialog::getText(this, i18n("Add Color To Palette"), i18n("Color name:"));
         KoColorPatch *patch = new KoColorPatch(widget.patchesFrame);
         patch->setColor(newEntry.color);
+        patch->setToolTip(newEntry.name);
         connect(patch, SIGNAL(triggered(KoColorPatch *)), this, SLOT(setTextLabel(KoColorPatch *)));
         Q_ASSERT(m_gridLayout);
         Q_ASSERT(m_activeColorSet);
-        m_gridLayout->addWidget(patch, m_activeColorSet->nColors()/16, m_activeColorSet->nColors()%16);
+        m_gridLayout->addWidget(patch, m_activeColorSet->nColors()/m_activeColorSet->columnCount(), m_activeColorSet->nColors()%m_activeColorSet->columnCount());
         m_activeColorSet->add(newEntry);
     }
 }
diff --git a/plugins/dockers/animation/onion_skins_docker.cpp b/plugins/dockers/animation/onion_skins_docker.cpp
index 230f490..ab0879a 100644
--- a/plugins/dockers/animation/onion_skins_docker.cpp
+++ b/plugins/dockers/animation/onion_skins_docker.cpp
@@ -30,6 +30,7 @@
 #include "KisViewManager.h"
 #include "kis_action_manager.h"
 #include "kis_action.h"
+#include <KoColorSpaceRegistry.h>
 
 #include "kis_equalizer_widget.h"
 
@@ -63,8 +64,8 @@ OnionSkinsDocker::OnionSkinsDocker(QWidget *parent) :
     connect(m_equalizerWidget, SIGNAL(sigConfigChanged()), &m_updatesCompressor, SLOT(start()));
     layout->addWidget(m_equalizerWidget, 1);
 
-    connect(ui->btnBackwardColor, SIGNAL(changed(QColor)), &m_updatesCompressor, SLOT(start()));
-    connect(ui->btnForwardColor, SIGNAL(changed(QColor)), &m_updatesCompressor, SLOT(start()));
+    connect(ui->btnBackwardColor, SIGNAL(changed(KoColor)), &m_updatesCompressor, SLOT(start()));
+    connect(ui->btnForwardColor, SIGNAL(changed(KoColor)), &m_updatesCompressor, SLOT(start()));
     connect(ui->doubleTintFactor, SIGNAL(valueChanged(qreal)), &m_updatesCompressor, SLOT(start()));
 
     connect(&m_updatesCompressor, SIGNAL(timeout()),
@@ -152,8 +153,8 @@ void OnionSkinsDocker::changed()
     }
 
     config.setOnionSkinTintFactor(ui->doubleTintFactor->value() * 255.0 / 100.0);
-    config.setOnionSkinTintColorBackward(ui->btnBackwardColor->color());
-    config.setOnionSkinTintColorForward(ui->btnForwardColor->color());
+    config.setOnionSkinTintColorBackward(ui->btnBackwardColor->color().toQColor());
+    config.setOnionSkinTintColorForward(ui->btnForwardColor->color().toQColor());
 
     KisOnionSkinCompositor::instance()->configChanged();
 }
@@ -168,8 +169,11 @@ void OnionSkinsDocker::loadSettings()
                         m_equalizerWidget);
 
     ui->doubleTintFactor->setValue(config.onionSkinTintFactor() * 100.0 / 255);
-    ui->btnBackwardColor->setColor(config.onionSkinTintColorBackward());
-    ui->btnForwardColor->setColor(config.onionSkinTintColorForward());
+    KoColor bcol(KoColorSpaceRegistry::instance()->rgb8());
+    bcol.fromQColor(config.onionSkinTintColorBackward());
+    ui->btnBackwardColor->setColor(bcol);
+    bcol.fromQColor(config.onionSkinTintColorForward());
+    ui->btnForwardColor->setColor(bcol);
 
     KisEqualizerWidget::EqualizerValues v;
     v.maxDistance = 10;
diff --git a/plugins/dockers/animation/onion_skins_docker.ui b/plugins/dockers/animation/onion_skins_docker.ui
index e232c23..001b8cc 100644
--- a/plugins/dockers/animation/onion_skins_docker.ui
+++ b/plugins/dockers/animation/onion_skins_docker.ui
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>299</width>
+    <width>356</width>
     <height>368</height>
    </rect>
   </property>
@@ -54,7 +54,7 @@
       </layout>
      </item>
      <item>
-      <widget class="KisDoubleSliderSpinBox" name="doubleTintFactor">
+      <widget class="KisDoubleSliderSpinBox" name="doubleTintFactor" native="true">
        <property name="minimumSize">
         <size>
          <width>50</width>
@@ -66,7 +66,7 @@
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_2">
        <item>
-        <widget class="KColorButton" name="btnBackwardColor">
+        <widget class="KisColorButton" name="btnBackwardColor">
          <property name="text">
           <string/>
          </property>
@@ -100,7 +100,7 @@
         </widget>
        </item>
        <item>
-        <widget class="KColorButton" name="btnForwardColor">
+        <widget class="KisColorButton" name="btnForwardColor">
          <property name="text">
           <string/>
          </property>
@@ -111,24 +111,19 @@
     </layout>
    </item>
   </layout>
-  <zorder>lblPrevColor</zorder>
-  <zorder>btnBackwardColor</zorder>
-  <zorder>btnForwardColor</zorder>
-  <zorder>lblNextColor</zorder>
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
-   <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-   <container>1</container>
-  </customwidget>
-  <customwidget>
    <class>KisDoubleSliderSpinBox</class>
    <extends>QWidget</extends>
    <header>kis_slider_spin_box.h</header>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>KisColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_color_button.h</header>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
diff --git a/plugins/dockers/digitalmixer/digitalmixer_dock.cc b/plugins/dockers/digitalmixer/digitalmixer_dock.cc
index 8cb19dc..6da7c71 100644
--- a/plugins/dockers/digitalmixer/digitalmixer_dock.cc
+++ b/plugins/dockers/digitalmixer/digitalmixer_dock.cc
@@ -30,6 +30,8 @@
 #include <KoCanvasResourceManager.h>
 #include <KoCanvasBase.h>
 
+#include <kis_color_button.h>
+
 class DigitalMixerPatch : public KoColorPatch {
     public:
         DigitalMixerPatch(QWidget* parent) : KoColorPatch(parent) {}
@@ -43,7 +45,13 @@ DigitalMixerDock::DigitalMixerDock( )
     : QDockWidget(i18n("Digital Colors Mixer")), m_canvas(0)
     , m_tellCanvas(true)
 {
-    QColor initColors[6] = { Qt::black, Qt::white, Qt::red, Qt::green, Qt::blue, Qt::yellow };
+    const KoColorSpace *sRGB = KoColorSpaceRegistry::instance()->rgb8();
+    KoColor initColors[6] = { KoColor(Qt::black, sRGB),
+                              KoColor(Qt::white, sRGB),
+                              KoColor(Qt::red, sRGB),
+                              KoColor(Qt::green, sRGB),
+                              KoColor(Qt::blue, sRGB),
+                              KoColor(Qt::yellow, sRGB) };
 
     QWidget* widget = new QWidget(this);
     QGridLayout* layout = new QGridLayout( widget );
@@ -75,16 +83,14 @@ DigitalMixerDock::DigitalMixerDock( )
         mixer.targetSlider->setFixedWidth(22);
         mixer.targetSlider->setMinimumHeight(66);
         layout->addWidget(mixer.targetSlider, 1, i + 1);
-        QToolButton* colorSelector = new QToolButton( this );
-        mixer.actionColor = new KoColorPopupAction(this);
-        mixer.actionColor->setCurrentColor(initColors[i]);
-        colorSelector->setDefaultAction(mixer.actionColor);
-        colorSelector->setFixedSize(colorSelector->sizeHint());
-        layout->addWidget(colorSelector, 2, i + 1);
+        mixer.actionColor = new KisColorButton( this );
+        mixer.actionColor->setColor(initColors[i]);
+        mixer.actionColor->setFixedWidth(22);
+        layout->addWidget(mixer.actionColor, 2, i + 1);
 
         m_mixers.push_back(mixer);
 
-        connect(mixer.actionColor, SIGNAL(colorChanged(KoColor)), signalMapperSelectColor, SLOT(map()));
+        connect(mixer.actionColor, SIGNAL(changed(KoColor)), signalMapperSelectColor, SLOT(map()));
         signalMapperSelectColor->setMapping(mixer.actionColor, i);
 
         connect(mixer.targetSlider, SIGNAL(valueChanged(int)), signalMapperColorSlider, SLOT(map()));
@@ -120,7 +126,7 @@ void DigitalMixerDock::setCanvas(KoCanvasBase * canvas)
 
 void DigitalMixerDock::popupColorChanged(int i)
 {
-    KoColor color = m_mixers[i].actionColor->currentKoColor();
+    KoColor color = m_mixers[i].actionColor->color();
     color.convertTo(m_currentColor.colorSpace());
     m_mixers[i].targetSlider->setColors( color, m_currentColor);
     colorSliderChanged(i);
diff --git a/plugins/dockers/digitalmixer/digitalmixer_dock.h b/plugins/dockers/digitalmixer/digitalmixer_dock.h
index 1604b4b..21677b3 100644
--- a/plugins/dockers/digitalmixer/digitalmixer_dock.h
+++ b/plugins/dockers/digitalmixer/digitalmixer_dock.h
@@ -25,6 +25,7 @@
 class KoColorPopupAction;
 class KoColorSlider;
 class KoColorPatch;
+class KisColorButton;
 
 class DigitalMixerDock : public QDockWidget, public KoCanvasObserverBase {
     Q_OBJECT
@@ -48,7 +49,7 @@ private:
     struct Mixer {
       KoColorPatch* targetColor;
       KoColorSlider* targetSlider;
-      KoColorPopupAction* actionColor;
+      KisColorButton* actionColor;
     };
     QList<Mixer> m_mixers;
     bool m_tellCanvas;
diff --git a/plugins/dockers/palettedocker/palettedocker_dock.cpp b/plugins/dockers/palettedocker/palettedocker_dock.cpp
index a436356..d641835 100644
--- a/plugins/dockers/palettedocker/palettedocker_dock.cpp
+++ b/plugins/dockers/palettedocker/palettedocker_dock.cpp
@@ -304,6 +304,7 @@ void PaletteDockerDock::entrySelected(QModelIndex index)
     int i = index.row()*m_model->columnCount()+index.column();
     if (i < m_currentColorSet->nColors()) {
         KoColorSetEntry entry = m_currentColorSet->getColor(i);
+        m_wdgPaletteDock->lblColorName->setText(entry.name);
         if (m_resourceProvider) {
             m_resourceProvider->setFGColor(entry.color);
         }
diff --git a/plugins/dockers/palettedocker/wdgpalettedock.ui b/plugins/dockers/palettedocker/wdgpalettedock.ui
index 0154b44..28e41e6 100644
--- a/plugins/dockers/palettedocker/wdgpalettedock.ui
+++ b/plugins/dockers/palettedocker/wdgpalettedock.ui
@@ -14,7 +14,16 @@
    <property name="spacing">
     <number>1</number>
    </property>
-   <property name="margin">
+   <property name="leftMargin">
+    <number>0</number>
+   </property>
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <property name="rightMargin">
+    <number>0</number>
+   </property>
+   <property name="bottomMargin">
     <number>0</number>
    </property>
    <item>
@@ -29,7 +38,26 @@
    </item>
    <item>
     <layout class="QGridLayout" name="gridLayout">
-     <item row="0" column="1">
+     <item row="0" column="5">
+      <widget class="QToolButton" name="bnAddDialog">
+       <property name="toolTip">
+        <string>Add color</string>
+       </property>
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>22</width>
+         <height>22</height>
+        </size>
+       </property>
+       <property name="autoRaise">
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="2">
       <spacer name="horizontalSpacer">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
@@ -42,7 +70,14 @@
        </property>
       </spacer>
      </item>
-     <item row="0" column="5">
+     <item row="0" column="0">
+      <widget class="KisPopupButton" name="bnColorSets">
+       <property name="text">
+        <string/>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="6">
       <widget class="QToolButton" name="bnRemove">
        <property name="toolTip">
         <string>Delete color</string>
@@ -61,7 +96,7 @@
        </property>
       </widget>
      </item>
-     <item row="0" column="3">
+     <item row="0" column="4">
       <widget class="QToolButton" name="bnAdd">
        <property name="toolTip">
         <string>Add foreground color</string>
@@ -80,27 +115,17 @@
        </property>
       </widget>
      </item>
-     <item row="0" column="4">
-      <widget class="QToolButton" name="bnAddDialog">
-       <property name="toolTip">
-        <string>Add color</string>
-       </property>
-       <property name="text">
-        <string>...</string>
-       </property>
-       <property name="iconSize">
+     <item row="0" column="1">
+      <widget class="QLabel" name="lblColorName">
+       <property name="minimumSize">
         <size>
-         <width>22</width>
-         <height>22</height>
+         <width>60</width>
+         <height>0</height>
         </size>
        </property>
-       <property name="autoRaise">
-        <bool>false</bool>
+       <property name="frameShape">
+        <enum>QFrame::StyledPanel</enum>
        </property>
-      </widget>
-     </item>
-     <item row="0" column="0">
-      <widget class="KisPopupButton" name="bnColorSets">
        <property name="text">
         <string/>
        </property>
diff --git a/plugins/dockers/specificcolorselector/CMakeLists.txt b/plugins/dockers/specificcolorselector/CMakeLists.txt
index 98359c5..b05aff2 100644
--- a/plugins/dockers/specificcolorselector/CMakeLists.txt
+++ b/plugins/dockers/specificcolorselector/CMakeLists.txt
@@ -1,4 +1,8 @@
-set(KRITA_SPECIFICCOLORSELECTOR_SOURCES specificcolorselector.cc specificcolorselector_dock.cc kis_specific_color_selector_widget.cc kis_color_input.cc )
+set(KRITA_SPECIFICCOLORSELECTOR_SOURCES 
+    specificcolorselector.cc 
+    specificcolorselector_dock.cc 
+    kis_specific_color_selector_widget.cc 
+)
 add_library(kritaspecificcolorselector MODULE ${KRITA_SPECIFICCOLORSELECTOR_SOURCES})
 target_link_libraries(kritaspecificcolorselector kritaui ${OPENEXR_LIBRARIES})
 install(TARGETS kritaspecificcolorselector  DESTINATION ${KRITA_PLUGIN_INSTALL_DIR})
diff --git a/plugins/dockers/specificcolorselector/kis_specific_color_selector_widget.cc b/plugins/dockers/specificcolorselector/kis_specific_color_selector_widget.cc
index c6dc9be..f5bb7e7 100644
--- a/plugins/dockers/specificcolorselector/kis_specific_color_selector_widget.cc
+++ b/plugins/dockers/specificcolorselector/kis_specific_color_selector_widget.cc
@@ -31,12 +31,12 @@
 #include <KoColorSpace.h>
 #include <KoColorSpaceRegistry.h>
 
-#include "kis_color_input.h"
+#include <kis_color_input.h>
 #include <KoColorProfile.h>
-#include "kis_debug.h"
-#include "kis_color_space_selector.h"
-#include "kis_signal_compressor.h"
-#include "kis_display_color_converter.h"
+#include <kis_debug.h>
+#include <kis_color_space_selector.h>
+#include <kis_signal_compressor.h>
+#include <kis_display_color_converter.h>
 
 
 KisSpecificColorSelectorWidget::KisSpecificColorSelectorWidget(QWidget* parent)
diff --git a/plugins/extensions/layersplit/dlg_layersplit.cpp b/plugins/extensions/layersplit/dlg_layersplit.cpp
index cb55361..1656834 100644
--- a/plugins/extensions/layersplit/dlg_layersplit.cpp
+++ b/plugins/extensions/layersplit/dlg_layersplit.cpp
@@ -20,6 +20,8 @@
 #include "dlg_layersplit.h"
 
 #include <klocalizedstring.h>
+
+#include <KoResourceServerProvider.h>
 #include <kis_debug.h>
 
 #include <KisViewManager.h>
@@ -45,6 +47,11 @@ DlgLayerSplit::DlgLayerSplit()
     m_page->intFuzziness->setSingleStep(1);
 
 
+
+    m_colorSetChooser = new KisColorsetChooser();
+    m_page->paletteChooser->setPopupWidget(m_colorSetChooser);
+    connect(m_colorSetChooser, SIGNAL(paletteSelected(KoColorSet*)), this, SLOT(slotSetPalette(KoColorSet*)));
+
     KisConfig cfg;
     m_page->intFuzziness->setValue(cfg.readEntry<int>("layersplit/fuzziness", 20));
     m_page->chkCreateGroupLayer->setChecked(cfg.readEntry<bool>("layerspit/createmastergroup", true));
@@ -54,6 +61,17 @@ DlgLayerSplit::DlgLayerSplit()
     m_page->chkSortLayers->setChecked(cfg.readEntry<bool>("layerspit/sortlayers", true));
     m_page->chkDisregardOpacity->setChecked(cfg.readEntry<bool>("layerspit/disregardopacity", true));
 
+    QString paletteName = cfg.readEntry<QString>("layersplit/paletteName", "Default");
+    KoResourceServer<KoColorSet> *pserver = KoResourceServerProvider::instance()->paletteServer(false);
+    KoColorSet *pal = pserver->resourceByName(paletteName);
+    if (pal) {
+        m_palette = pal;
+        m_page->paletteChooser->setText(pal->name());
+        QIcon icon(QPixmap::fromImage(pal->image()));
+        m_page->paletteChooser->setIcon(icon);
+    }
+
+
     connect(this, SIGNAL(applyClicked()), this, SLOT(applyClicked()));
 
     setMainWidget(m_page);
@@ -73,6 +91,7 @@ void DlgLayerSplit::applyClicked()
     cfg.writeEntry("layerspit/hideoriginal", m_page->chkHideOriginal->isChecked());
     cfg.writeEntry("layerspit/sortlayers", m_page->chkSortLayers->isChecked());
     cfg.writeEntry("layerspit/disregardopacity", m_page->chkDisregardOpacity->isChecked());
+    cfg.writeEntry("layersplit/paletteName", m_palette->name());
 
     accept();
 }
@@ -113,5 +132,17 @@ int DlgLayerSplit::fuzziness() const
 
 }
 
+KoColorSet *DlgLayerSplit::palette() const
+{
+    return m_palette;
+}
 
-
+void DlgLayerSplit::slotSetPalette(KoColorSet *pal)
+{
+    if (pal) {
+        m_palette = pal;
+        m_page->paletteChooser->setText(pal->name());
+        QIcon icon(QPixmap::fromImage(pal->image()));
+        m_page->paletteChooser->setIcon(icon);
+    }
+}
diff --git a/plugins/extensions/layersplit/dlg_layersplit.h b/plugins/extensions/layersplit/dlg_layersplit.h
index aced7bf..5f35425 100644
--- a/plugins/extensions/layersplit/dlg_layersplit.h
+++ b/plugins/extensions/layersplit/dlg_layersplit.h
@@ -20,7 +20,8 @@
 #define DLG_LAYERSPLIT
 
 #include <KoDialog.h>
-
+#include <KoColorSet.h>
+#include <KisColorsetChooser.h>
 #include <kis_types.h>
 
 #include "wdg_layersplit.h"
@@ -46,13 +47,17 @@ public:
     bool sortLayers() const;
     bool disregardOpacity() const;
     int fuzziness() const;
+    KoColorSet* palette() const;
 
 private Q_SLOTS:
 
     void applyClicked();
+    void slotSetPalette(KoColorSet *pal);
 
 private:
     WdgLayerSplit* m_page;
+    KisColorsetChooser *m_colorSetChooser;
+    KoColorSet *m_palette;
 };
 
 #endif // DLG_LAYERSPLIT
diff --git a/plugins/extensions/layersplit/layersplit.cpp b/plugins/extensions/layersplit/layersplit.cpp
index 15d60aa..6d01d05 100644
--- a/plugins/extensions/layersplit/layersplit.cpp
+++ b/plugins/extensions/layersplit/layersplit.cpp
@@ -149,9 +149,13 @@ void LayerSplit::slotLayerSplit()
                 }
 
                 if (!found) {
+                    QString name = dlg.palette()->closestColorName(c);
+                    if (name.toLower() == "untitled" || name.toLower() == "none" || name.toLower() == "") {
+                        name = KoColor::toQString(c);
+                    }
                     Layer l;
                     l.color = c;
-                    l.device = new KisPaintDevice(cs, KoColor::toQString(c));
+                    l.device = new KisPaintDevice(cs, name);
                     l.accessor = l.device->createRandomAccessorNG(col, row);
                     l.accessor->moveTo(col, row);
                     memcpy(l.accessor->rawData(), acc->rawDataConst(), cs->pixelSize());
diff --git a/plugins/extensions/layersplit/wdg_layersplit.ui b/plugins/extensions/layersplit/wdg_layersplit.ui
index 6b48346..927b670 100644
--- a/plugins/extensions/layersplit/wdg_layersplit.ui
+++ b/plugins/extensions/layersplit/wdg_layersplit.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>449</width>
-    <height>271</height>
+    <height>273</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -77,7 +77,7 @@
       </widget>
      </item>
      <item row="6" column="1">
-      <widget class="KisSliderSpinBox" name="intFuzziness"/>
+      <widget class="KisSliderSpinBox" name="intFuzziness" native="true"/>
      </item>
      <item row="5" column="0">
       <widget class="QCheckBox" name="chkDisregardOpacity">
@@ -86,6 +86,20 @@
        </property>
       </widget>
      </item>
+     <item row="7" column="0" colspan="2">
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>Palette to use for naming the layers:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="8" column="0" colspan="2">
+      <widget class="KisPopupButton" name="paletteChooser">
+       <property name="text">
+        <string>Choose Palette</string>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
    <item>
@@ -124,6 +138,11 @@
  </widget>
  <customwidgets>
   <customwidget>
+   <class>KisPopupButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_popup_button.h</header>
+  </customwidget>
+  <customwidget>
    <class>KisSliderSpinBox</class>
    <extends>QWidget</extends>
    <header location="global">kis_slider_spin_box.h</header>
diff --git a/plugins/filters/colors/kis_wdg_color_to_alpha.cpp b/plugins/filters/colors/kis_wdg_color_to_alpha.cpp
index e45e7b0..1d13900 100644
--- a/plugins/filters/colors/kis_wdg_color_to_alpha.cpp
+++ b/plugins/filters/colors/kis_wdg_color_to_alpha.cpp
@@ -33,6 +33,7 @@
 #include <kis_selection.h>
 #include <kis_paint_device.h>
 #include <kis_processing_information.h>
+#include <KoColorSpaceRegistry.h>
 
 #include "ui_wdgcolortoalphabase.h"
 
@@ -48,11 +49,12 @@ KisWdgColorToAlpha::KisWdgColorToAlpha(QWidget * parent)
 
     m_widget->intThreshold->setRange(1, 255, 0);
 
-    connect(m_widget->colorSelector, SIGNAL(colorChanged(const QColor&)), SLOT(slotColorSelectorChanged(const QColor&)));
+    connect(m_widget->colorSelector, SIGNAL(sigNewColor(KoColor)), SLOT(slotColorSelectorChanged(const KoColor&)));
     connect(m_widget->intThreshold, SIGNAL(valueChanged(qreal)), SIGNAL(sigConfigurationItemChanged()));
-    connect(m_widget->btnCustomColor, SIGNAL(changed(const QColor&)), SLOT(slotCustomColorSelected(const QColor&)));
+    connect(m_widget->btnCustomColor, SIGNAL(changed(const KoColor)), SLOT(slotCustomColorSelected(const KoColor&)));
 
-    m_widget->btnCustomColor->setColor(Qt::white);
+    KoColor c(Qt::white, KoColorSpaceRegistry::instance()->rgb8());
+    m_widget->btnCustomColor->setColor(c);
 }
 
 KisWdgColorToAlpha::~KisWdgColorToAlpha()
@@ -67,17 +69,17 @@ void KisWdgColorToAlpha::setView(KisViewManager *view)
 
 void KisWdgColorToAlpha::slotFgColorChanged(const KoColor &color)
 {
-    m_widget->btnCustomColor->setColor(color.toQColor());
+    m_widget->btnCustomColor->setColor(color);
 }
 
-void KisWdgColorToAlpha::slotColorSelectorChanged(const QColor &color)
+void KisWdgColorToAlpha::slotColorSelectorChanged(const KoColor &color)
 {
     m_widget->btnCustomColor->setColor(color);
 }
 
-void KisWdgColorToAlpha::slotCustomColorSelected(const QColor &color)
+void KisWdgColorToAlpha::slotCustomColorSelected(const KoColor &color)
 {
-    m_widget->colorSelector->setQColor(color);
+    m_widget->colorSelector->slotSetColor(color);
     emit sigConfigurationItemChanged();
 }
 
@@ -85,7 +87,13 @@ void KisWdgColorToAlpha::setConfiguration(const KisPropertiesConfiguration* conf
 {
     QVariant value;
     if (config->getProperty("targetcolor", value)) {
-        m_widget->colorSelector->setQColor(value.value<QColor>());
+        KoColor c;
+        if (value.value<QColor>().isValid()) {
+            c.fromQColor(value.value<QColor>());
+        } else {
+            c = value.value<KoColor>();
+        }
+        m_widget->colorSelector->slotSetColor(c);
     }
     if (config->getProperty("threshold", value)) {
         m_widget->intThreshold->setValue(value.toInt());
@@ -95,7 +103,7 @@ void KisWdgColorToAlpha::setConfiguration(const KisPropertiesConfiguration* conf
 KisPropertiesConfiguration* KisWdgColorToAlpha::configuration() const
 {
     KisFilterConfiguration* config = new KisFilterConfiguration("colortoalpha", 1);
-    config->setProperty("targetcolor", widget()->colorSelector->color());
+    config->setProperty("targetcolor", widget()->colorSelector->getCurrentColor().toQColor());
     config->setProperty("threshold", widget()->intThreshold->value());
     return config;
 }
diff --git a/plugins/filters/colors/kis_wdg_color_to_alpha.h b/plugins/filters/colors/kis_wdg_color_to_alpha.h
index 2b7a7cf..2a2937d 100644
--- a/plugins/filters/colors/kis_wdg_color_to_alpha.h
+++ b/plugins/filters/colors/kis_wdg_color_to_alpha.h
@@ -49,8 +49,8 @@ protected:
 
 private Q_SLOTS:
     void slotFgColorChanged(const KoColor &color);
-    void slotColorSelectorChanged(const QColor &color);
-    void slotCustomColorSelected(const QColor &color);
+    void slotColorSelectorChanged(const KoColor &color);
+    void slotCustomColorSelected(const KoColor &color);
 
 private:
     Ui_WdgColorToAlphaBase* m_widget;
diff --git a/plugins/filters/colors/wdgcolortoalphabase.ui b/plugins/filters/colors/wdgcolortoalphabase.ui
index 4d7c8b3..961c772 100644
--- a/plugins/filters/colors/wdgcolortoalphabase.ui
+++ b/plugins/filters/colors/wdgcolortoalphabase.ui
@@ -63,7 +63,7 @@
     </layout>
    </item>
    <item>
-    <widget class="KoTriangleColorSelector" name="colorSelector">
+    <widget class="KisVisualColorSelector" name="colorSelector" native="true">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
        <horstretch>0</horstretch>
@@ -139,7 +139,7 @@
       </widget>
      </item>
      <item row="1" column="1">
-      <widget class="KisDoubleSliderSpinBox" name="intThreshold">
+      <widget class="KisDoubleSliderSpinBox" name="intThreshold" native="true">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
          <horstretch>0</horstretch>
@@ -162,7 +162,7 @@
       </widget>
      </item>
      <item row="0" column="1">
-      <widget class="KColorButton" name="btnCustomColor">
+      <widget class="KisColorButton" name="btnCustomColor">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
          <horstretch>0</horstretch>
@@ -192,16 +192,15 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
-   <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
+   <class>KisVisualColorSelector</class>
+   <extends>QWidget</extends>
+   <header>kis_visual_color_selector.h</header>
    <container>1</container>
   </customwidget>
   <customwidget>
-   <class>KoTriangleColorSelector</class>
-   <extends>QWidget</extends>
-   <header>KoTriangleColorSelector.h</header>
-   <container>1</container>
+   <class>KisColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_color_button.h</header>
   </customwidget>
   <customwidget>
    <class>KisDoubleSliderSpinBox</class>
diff --git a/plugins/filters/indexcolors/kiswdgindexcolors.cpp b/plugins/filters/indexcolors/kiswdgindexcolors.cpp
index 22a57c9..c375e6e 100644
--- a/plugins/filters/indexcolors/kiswdgindexcolors.cpp
+++ b/plugins/filters/indexcolors/kiswdgindexcolors.cpp
@@ -28,7 +28,7 @@
 
 #include "kis_int_parse_spin_box.h"
 
-#include <kcolorbutton.h>
+#include <kis_color_button.h>
 
 KisWdgIndexColors::KisWdgIndexColors(QWidget* parent, Qt::WFlags f, int delay): KisConfigWidget(parent, f, delay)
 {
@@ -100,7 +100,7 @@ void KisWdgIndexColors::setup(QStringList shadesLabels, int ramps)
     for(int y = 0; y < rows; ++y)
         for(int x = 0; x < collumns; ++x)
         {
-            KColorButton* b = new KColorButton;
+            KisColorButton* b = new KisColorButton;
             QCheckBox* c = new QCheckBox;
             c->setChecked(false);
             b->setEnabled(false);
@@ -109,7 +109,7 @@ void KisWdgIndexColors::setup(QStringList shadesLabels, int ramps)
 
             connect(c, SIGNAL(toggled(bool)), b, SLOT(setEnabled(bool)));
             connect(c, SIGNAL(toggled(bool)), this, SIGNAL(sigConfigurationItemChanged()));
-            connect(b, SIGNAL(changed(QColor)), this, SIGNAL(sigConfigurationItemChanged()));
+            connect(b, SIGNAL(changed(KoColor)), this, SIGNAL(sigConfigurationItemChanged()));
 
             QHBoxLayout* cell = new QHBoxLayout();
             cell->setSpacing(0);
@@ -133,7 +133,7 @@ KisPropertiesConfiguration* KisWdgIndexColors::configuration() const
     for(int y = 0; y < 4; ++y)
         for(int x = 0; x < 4; ++x)
         {
-            palCfg.colors[y][x] = m_colorSelectors[y][x].button->color();
+            palCfg.colors[y][x] = m_colorSelectors[y][x].button->color().toQColor();
             palCfg.colorsEnabled[y][x] = m_colorSelectors[y][x].button->isEnabled();
         }
 
@@ -179,7 +179,9 @@ void KisWdgIndexColors::setConfiguration(const KisPropertiesConfiguration* confi
         {
             m_colorSelectors[y][x].checkbox->setChecked(palCfg.colorsEnabled[y][x]);
             m_colorSelectors[y][x].button->setEnabled(palCfg.colorsEnabled[y][x]);
-            m_colorSelectors[y][x].button->setColor(palCfg.colors[y][x]);
+            KoColor c;
+            c.fromQColor(palCfg.colors[y][x]);
+            m_colorSelectors[y][x].button->setColor(c);
         }
 
     for(int y = 0; y < 3; ++y)
diff --git a/plugins/filters/indexcolors/kiswdgindexcolors.h b/plugins/filters/indexcolors/kiswdgindexcolors.h
index 4f32831..f1d4605 100644
--- a/plugins/filters/indexcolors/kiswdgindexcolors.h
+++ b/plugins/filters/indexcolors/kiswdgindexcolors.h
@@ -27,7 +27,7 @@
 #include <QSpinBox>
 
 class QCheckBox;
-class KColorButton;
+class KisColorButton;
 namespace Ui
 {
 class KisWdgIndexColors;
@@ -48,7 +48,7 @@ private Q_SLOTS:
 private:
     struct ColorWidgets
     {
-        KColorButton* button;
+        KisColorButton* button;
         QCheckBox* checkbox;
     };
     QVector< QVector<ColorWidgets> > m_colorSelectors;
diff --git a/plugins/generators/pattern/wdgpatternoptions.ui b/plugins/generators/pattern/wdgpatternoptions.ui
index bc75be6..47e3dd0 100644
--- a/plugins/generators/pattern/wdgpatternoptions.ui
+++ b/plugins/generators/pattern/wdgpatternoptions.ui
@@ -52,10 +52,10 @@
       </widget>
      </item>
      <item row="1" column="1">
-      <widget class="KColorButton" name="bnColor"/>
+      <widget class="KisColorButton" name="bnColor"/>
      </item>
      <item row="0" column="1">
-      <widget class="KisPatternChooser" name="patternChooser">
+      <widget class="KisPatternChooser" name="patternChooser" native="true">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
          <horstretch>0</horstretch>
@@ -70,9 +70,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
+   <header>kis_color_button.h</header>
   </customwidget>
   <customwidget>
    <class>KisPatternChooser</class>
diff --git a/plugins/generators/solid/colorgenerator.cpp b/plugins/generators/solid/colorgenerator.cpp
index d147d74..6726888 100644
--- a/plugins/generators/solid/colorgenerator.cpp
+++ b/plugins/generators/solid/colorgenerator.cpp
@@ -100,4 +100,4 @@ void KisColorGenerator::generate(KisProcessingInformation dstInfo,
     }
 }
 
-#include "colorgenerator.moc"
\ No newline at end of file
+#include "colorgenerator.moc"
diff --git a/plugins/generators/solid/kis_wdg_color.cpp b/plugins/generators/solid/kis_wdg_color.cpp
index a48e1f1..83624ec 100644
--- a/plugins/generators/solid/kis_wdg_color.cpp
+++ b/plugins/generators/solid/kis_wdg_color.cpp
@@ -27,11 +27,12 @@
 
 #include "ui_wdgcoloroptions.h"
 
-KisWdgColor::KisWdgColor(QWidget* parent)
+KisWdgColor::KisWdgColor(QWidget* parent, const KoColorSpace *cs)
         : KisConfigWidget(parent)
 {
     m_widget = new Ui_WdgColorOptions();
     m_widget->setupUi(this);
+    m_cs = cs;
 }
 
 KisWdgColor::~KisWdgColor()
@@ -43,14 +44,16 @@ KisWdgColor::~KisWdgColor()
 void KisWdgColor::setConfiguration(const KisPropertiesConfiguration* config)
 {
     QVariant value;
-    widget()->bnColor->setColor(config->getColor("color").toQColor());
+    KoColor c =config->getColor("color");
+    c.convertTo(m_cs);
+    widget()->bnColor->setColor(c);
 }
 
 KisPropertiesConfiguration* KisWdgColor::configuration() const
 {
     KisFilterConfiguration* config = new KisFilterConfiguration("color", 1);
     KoColor c;
-    c.fromQColor(this->widget()->bnColor->color());
+    c.fromKoColor(this->widget()->bnColor->color());
     QVariant v;
     v.setValue(c);
     config->setProperty("color", v);
diff --git a/plugins/generators/solid/kis_wdg_color.h b/plugins/generators/solid/kis_wdg_color.h
index 2410a14..55ce1e5 100644
--- a/plugins/generators/solid/kis_wdg_color.h
+++ b/plugins/generators/solid/kis_wdg_color.h
@@ -22,6 +22,8 @@
 #define KIS_WDG_COLOR_H
 
 #include <kis_config_widget.h>
+#include <KoColorSpace.h>
+#include <KoColorSpaceRegistry.h>
 
 class Ui_WdgColorOptions;
 
@@ -29,7 +31,7 @@ class KisWdgColor : public KisConfigWidget
 {
     Q_OBJECT
 public:
-    KisWdgColor(QWidget* parent = 0);
+    KisWdgColor(QWidget* parent = 0, const KoColorSpace *cs = KoColorSpaceRegistry::instance()->rgb8());
     ~KisWdgColor();
 public:
     inline const Ui_WdgColorOptions* widget() const {
@@ -39,6 +41,7 @@ public:
     virtual KisPropertiesConfiguration* configuration() const;
 private:
     Ui_WdgColorOptions* m_widget;
+    const KoColorSpace *m_cs;
 };
 
 #endif
diff --git a/plugins/generators/solid/wdgcoloroptions.ui b/plugins/generators/solid/wdgcoloroptions.ui
index a28c4ad..b1f3e5e 100644
--- a/plugins/generators/solid/wdgcoloroptions.ui
+++ b/plugins/generators/solid/wdgcoloroptions.ui
@@ -25,7 +25,7 @@
     </widget>
    </item>
    <item row="0" column="2">
-    <widget class="KColorButton" name="bnColor"/>
+    <widget class="KisColorButton" name="bnColor"/>
    </item>
    <item row="0" column="3">
     <spacer>
@@ -63,9 +63,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
+   <header>kis_color_button.h</header>
   </customwidget>
  </customwidgets>
  <resources/>
diff --git a/plugins/impex/jpeg/kis_jpeg_export.cc b/plugins/impex/jpeg/kis_jpeg_export.cc
index 8169266..c252383 100644
--- a/plugins/impex/jpeg/kis_jpeg_export.cc
+++ b/plugins/impex/jpeg/kis_jpeg_export.cc
@@ -31,6 +31,7 @@
 #include <QFileInfo>
 
 #include <KoColorSpace.h>
+#include <KoColorSpaceRegistry.h>
 #include <KoColorProfile.h>
 #include <KisImportExportManager.h>
 #include <KisFilterChain.h>
@@ -120,8 +121,11 @@ KisImportExportFilter::ConversionStatus KisJPEGExport::convert(const QByteArray&
     wdgUi.chkSaveProfile->setChecked(cfg.getBool("saveProfile", true));
 
     QStringList rgb = cfg.getString("transparencyFillcolor", "255,255,255").split(',');
-    wdgUi.bnTransparencyFillColor->setDefaultColor(Qt::white);
-    wdgUi.bnTransparencyFillColor->setColor(QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt()));
+    KoColor background(KoColorSpaceRegistry::instance()->rgb8());
+    background.fromQColor(Qt::white);
+    wdgUi.bnTransparencyFillColor->setDefaultColor(background);
+    background.fromQColor(QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt()));
+    wdgUi.bnTransparencyFillColor->setColor(background);
 
     frm.setEnabledFilters(cfg.getString("filters").split(','));
 
@@ -170,7 +174,7 @@ KisImportExportFilter::ConversionStatus KisJPEGExport::convert(const QByteArray&
     options.xmp = wdgUi.xmp->isChecked();
     cfg.setProperty("xmp", options.xmp);
 
-    QColor c = wdgUi.bnTransparencyFillColor->color();
+    QColor c = wdgUi.bnTransparencyFillColor->color().toQColor();
     options.transparencyFillColor = c;
     cfg.setProperty("transparencyFillcolor", QString("%1,%2,%3").arg(c.red()).arg(c.green()).arg(c.blue()));
 
diff --git a/plugins/impex/jpeg/kis_wdg_options_jpeg.ui b/plugins/impex/jpeg/kis_wdg_options_jpeg.ui
index eb0dbbd..c159651 100644
--- a/plugins/impex/jpeg/kis_wdg_options_jpeg.ui
+++ b/plugins/impex/jpeg/kis_wdg_options_jpeg.ui
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>537</width>
+    <width>545</width>
     <height>390</height>
    </rect>
   </property>
@@ -41,7 +41,7 @@
           <number>20</number>
          </property>
          <item row="0" column="1">
-          <widget class="KisDoubleSliderSpinBox" name="qualityLevel">
+          <widget class="KisDoubleSliderSpinBox" name="qualityLevel" native="true">
            <property name="sizePolicy">
             <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
              <horstretch>0</horstretch>
@@ -89,7 +89,7 @@
           </widget>
          </item>
          <item row="1" column="1">
-          <widget class="KColorButton" name="bnTransparencyFillColor">
+          <widget class="KisColorButton" name="bnTransparencyFillColor">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
              <horstretch>0</horstretch>
@@ -145,7 +145,7 @@
           <number>20</number>
          </property>
          <item row="0" column="1">
-          <widget class="KisDoubleSliderSpinBox" name="smoothLevel">
+          <widget class="KisDoubleSliderSpinBox" name="smoothLevel" native="true">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
              <horstretch>0</horstretch>
@@ -343,16 +343,16 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KColorButton</class>
-   <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-  </customwidget>
-  <customwidget>
    <class>KisDoubleSliderSpinBox</class>
    <extends>QWidget</extends>
    <header>kis_slider_spin_box.h</header>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>KisColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kis_color_button.h</header>
+  </customwidget>
  </customwidgets>
  <tabstops>
   <tabstop>tabWidget</tabstop>
diff --git a/plugins/impex/png/kis_png_export.cc b/plugins/impex/png/kis_png_export.cc
index 7edb7cd..0f3aaf0 100644
--- a/plugins/impex/png/kis_png_export.cc
+++ b/plugins/impex/png/kis_png_export.cc
@@ -28,6 +28,7 @@
 #include <QMessageBox>
 
 #include <KoColorSpace.h>
+#include <KoColorSpaceRegistry.h>
 #include <KisFilterChain.h>
 #include <KisImportExportManager.h>
 #include <KoColorProfile.h>
@@ -165,8 +166,11 @@ KisImportExportFilter::ConversionStatus KisPNGExport::convert(const QByteArray&
         wdg->chkForceSRGB->setChecked(cfg.getBool("forceSRGB", false));
 
         QStringList rgb = cfg.getString("transparencyFillcolor", "0,0,0").split(',');
-        wdg->bnTransparencyFillColor->setDefaultColor(Qt::white);
-        wdg->bnTransparencyFillColor->setColor(QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt()));
+        KoColor background(KoColorSpaceRegistry::instance()->rgb8());
+        background.fromQColor(Qt::white);
+        wdg->bnTransparencyFillColor->setDefaultColor(background);
+        background.fromQColor(QColor(rgb[0].toInt(), rgb[1].toInt(), rgb[2].toInt()));
+        wdg->bnTransparencyFillColor->setColor(background);
 
         kdb->setMainWidget(wdg);
         QApplication::restoreOverrideCursor();
@@ -182,7 +186,7 @@ KisImportExportFilter::ConversionStatus KisPNGExport::convert(const QByteArray&
         bool interlace = wdg->interlacing->isChecked();
         int compression = (int)wdg->compressionLevel->value();
         bool tryToSaveAsIndexed = wdg->tryToSaveAsIndexed->isChecked();
-        QColor c = wdg->bnTransparencyFillColor->color();
+        QColor c = wdg->bnTransparencyFillColor->color().toQColor();
         bool saveSRGB = wdg->chkSRGB->isChecked();
         bool forceSRGB = wdg->chkForceSRGB->isChecked();
 
diff --git a/plugins/impex/png/kis_wdg_options_png.ui b/plugins/impex/png/kis_wdg_options_png.ui
index 3e4eb99b..405c28e 100644
--- a/plugins/impex/png/kis_wdg_options_png.ui
+++ b/plugins/impex/png/kis_wdg_options_png.ui
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>476</width>
+    <width>546</width>
     <height>243</height>
    </rect>
   </property>
@@ -52,7 +52,7 @@
       </widget>
      </item>
      <item row="1" column="1" colspan="2">
-      <widget class="KisDoubleSliderSpinBox" name="compressionLevel">
+      <widget class="KisDoubleSliderSpinBox" name="compressionLevel" native="true">
        <property name="toolTip">
         <string>Note: the compression level does not change the quality of the result</string>
        </property>
@@ -159,7 +159,7 @@ Enabling interlacing will cause the image to be displayed by the browser even wh
       </widget>
      </item>
      <item row="8" column="1">
-      <widget class="KColorButton" name="bnTransparencyFillColor">
+      <widget class="KisColorButton" name="bnTransparencyFillColor">
        <property name="sizePolicy">
         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
          <horstretch>0</horstretch>
@@ -205,9 +205,9 @@ Enabling interlacing will cause the image to be displayed by the browser even wh
    <container>1</container>
   </customwidget>
   <customwidget>
-   <class>KColorButton</class>
+   <class>KisColorButton</class>
    <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
+   <header>kis_color_button.h</header>
   </customwidget>
  </customwidgets>
  <resources/>


More information about the kimageshop mailing list