Skip to content

Fix 'Enforce palette colors' feature

In this patch:

  1. upon foreground color change, palette widgets always compute and highlight nearest color in their active palette (that is the behavior of 4.1)

  2. restores the 'Enforce palette colors' functionality to the internal color selector Since it is a function of the internal color selector, I have moved it from KisPaletteView to KisDlgInternalColorSelector, which now takes care of enforcing the nearest color from it's active palette, when the user selects a color using the internal color selector's widgets. The remaining problem is: should the selector also enforce the palette color when the foreground color is changed from the outside, e.g by color picker?

Test Plan

Feature: nearest color selection in color palette widget

Background: Given Krita is running and a document is open

Scenario 1: highlight nearest color in the palette docker

Given the color palette docker is enabled and has an active palette
When the user picks a color using ‘color selecting method’
    | color selecting method |
    | on-canvas color picker |
    | color selector docker |
Then the color palette widget highlights the swatch with nearest color
And the current foreground color is set to the color picked by user

Scenario 2: highlight nearest color in the internal color selector

Given the internal color selector dialog is open and has an active palette
And Enforce palette colors is OFF
When the user picks a color using ‘color selecting method’
    | color selecting method |
    | internal color selector’s widgets |
    | on-canvas color picker |
    | color selector docker |
Then the color palette widget highlights the swatch with nearest color
And the current foreground color is set to the color by user

Scenario 3: enforce palette colors in the internal color selector

Given the internal color selector dialog is open and Enforce palette colors is ON
When the user picks a color using the widgets in the internal color selector dialog
Then the color palette widget highlights the swatch with nearest color in it’s active palette
And current foreground color is set to this nearest color 

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Anna Medonosová

Merge request reports

Loading