feat: statuses and ticket types take any colour from a colour picker
Settings shows a native colour picker (the palette as suggestions) instead of the list of eleven names. The API takes a palette name, as before, or any #rrggbb; picking a palette colour still saves its name, so it keeps its hand-made dark version. A free colour gets one variant per theme, computed with the `color` library (moved towards white or black until it contrasts 3:1 with the surface) and applied with light-dark(): a pale yellow darkens on white, a navy lightens on dark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,25 @@ describe('Project settings', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('takes a palette colour or any #rrggbb, and nothing else', () => {
|
||||
const project = newProject();
|
||||
const settings = defaultProjectSettings();
|
||||
settings.statuses[0].color = '#7c3aed';
|
||||
settings.issueTypes[0].color = '#0EA5E9';
|
||||
project.updateSettings('owner', settings);
|
||||
expect(project.workflow.status(settings.statuses[0].id)?.color).toBe(
|
||||
'#7c3aed',
|
||||
);
|
||||
|
||||
for (const color of ['purple', '#abc', 'url(x)', '#7c3aedff']) {
|
||||
const bad = defaultProjectSettings();
|
||||
bad.statuses[0].color = color as never;
|
||||
expect(() => project.updateSettings('owner', bad)).toThrow(
|
||||
/Color no válido/,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
it('archives values instead of deleting them', () => {
|
||||
const project = newProject();
|
||||
const settings = defaultProjectSettings();
|
||||
|
||||
Reference in New Issue
Block a user