|
4 | 4 |
|
5 | 5 | import * as Common from '../../../../core/common/common.js'; |
6 | 6 | import * as i18n from '../../../../core/i18n/i18n.js'; |
7 | | -import * as IconButton from '../../../components/icon_button/icon_button.js'; |
8 | 7 | import * as UI from '../../legacy.js'; |
9 | 8 |
|
10 | 9 | const UIStrings = { |
11 | 10 | /** |
12 | | - * @description Tooltip text describing that a color was clipped after conversion to match the target gamut |
13 | | - * @example {rgb(255 255 255)} PH1 |
| 11 | + * @description Menu warning that some color will be clipped after conversion to match the target gamut |
14 | 12 | */ |
15 | | - colorClippedTooltipText: 'This color was clipped to match the format\'s gamut. The actual result was {PH1}', |
| 13 | + colorShiftWarning: '⚠️ Conversion to a narrow gamut will cause color shifts', |
16 | 14 | } as const; |
17 | 15 | const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/color_picker/FormatPickerContextMenu.ts', UIStrings); |
18 | 16 | const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_); |
@@ -56,10 +54,13 @@ export class FormatPickerContextMenu { |
56 | 54 | Common.Color.Format.XYZ_D65, |
57 | 55 | ]; |
58 | 56 | const menu = new UI.ContextMenu.ContextMenu(e, {onSoftMenuClosed: () => resolve()}); |
| 57 | + const disclamerSection = menu.section('disclaimer'); |
59 | 58 | const legacySection = menu.section('legacy'); |
60 | 59 | const wideSection = menu.section('wide'); |
61 | 60 | const colorFunctionSection = menu.section('color-function').appendSubMenuItem('color()', false, 'color').section(); |
62 | 61 |
|
| 62 | + disclamerSection.appendItem(i18nString(UIStrings.colorShiftWarning), () => {}, {disabled: true}); |
| 63 | + |
63 | 64 | if (!(this.#color instanceof Common.Color.Nickname)) { |
64 | 65 | const nickname = this.#color.asLegacyColor().nickname(); |
65 | 66 | if (nickname) { |
@@ -102,27 +103,13 @@ export class FormatPickerContextMenu { |
102 | 103 | return; |
103 | 104 | } |
104 | 105 | } |
105 | | - const label = newColor.asString(); |
| 106 | + const label = newColor.isGamutClipped() ? newColor.asString() + ' ⚠️' : newColor.asString(); |
106 | 107 | if (!label) { |
107 | 108 | return; |
108 | 109 | } |
109 | | - let icon = undefined; |
110 | | - if (newColor.isGamutClipped()) { |
111 | | - icon = new IconButton.Icon.Icon(); |
112 | | - icon.name = 'warning'; |
113 | | - icon.classList.add('medium'); |
114 | | - icon.style.marginLeft = '1px'; |
115 | | - icon.style.marginTop = '-1px'; |
116 | | - icon.style.minWidth = '16px'; |
117 | | - icon.style.minHeight = '16px'; |
118 | | - } |
119 | | - const tooltip = |
120 | | - icon ? i18nString(UIStrings.colorClippedTooltipText, {PH1: newColor.getAsRawString() ?? 'none'}) : undefined; |
121 | 110 |
|
122 | 111 | const handler = (): void => onSelect(newColor); |
123 | 112 |
|
124 | | - section.appendItem( |
125 | | - label, handler, |
126 | | - {additionalElement: icon, tooltip, jslogContext: newColor.isGamutClipped() ? 'color' : 'clipped-color'}); |
| 113 | + section.appendItem(label, handler, {jslogContext: newColor.isGamutClipped() ? 'color' : 'clipped-color'}); |
127 | 114 | } |
128 | 115 | } |
0 commit comments