Color Picker: add Oklab and Oklch color formats#38052
Color Picker: add Oklab and Oklch color formats#38052shuaiyuanxx merged 12 commits intomicrosoft:mainfrom
Conversation
|
@microsoft-github-policy-service agree |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the Color Picker utility to support additional color spaces by adding conversions and display formats for CIELCh, Oklab, and Oklch.
- Introduces new enum entries and helper functions for the additional color formats.
- Updates UI properties and configuration parameters to include the new formats and their corresponding localization keys.
- Augments color conversion routines in both the ColorRepresentationHelper and ColorFormatHelper classes.
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/settings-ui/Settings.UI/SettingsXAML/Controls/ColorFormatEditor.xaml.cs | Updated color format parameters with new entries and revised localization keys. |
| src/settings-ui/Settings.UI.Library/Enumerations/ColorRepresentationType.cs | Added enum entries for CIELCh, Oklab, and Oklch representations with updated comments. |
| src/settings-ui/Settings.UI.Library/ColorPickerProperties.cs | Included the new color formats in VisibleColorFormats for the Color Picker UI. |
| src/modules/colorPicker/ColorPickerUI/ViewModels/ColorEditorViewModel.cs | Integrated the new color formats into the ViewModel with appropriate conversion methods. |
| src/modules/colorPicker/ColorPickerUI/Helpers/ColorRepresentationHelper.cs | Added conversion methods for CIELCh, Oklab, and Oklch with appropriate rounding and string formatting. |
| src/common/ManagedCommon/ColorFormatHelper.cs | Implemented new conversion methods for the additional color spaces and updated the string representation cases. |
Files not reviewed (1)
- src/settings-ui/Settings.UI/Strings/en-us/Resources.resw: Language not supported
Comments suppressed due to low confidence (2)
src/common/ManagedCommon/ColorFormatHelper.cs:612
- [nitpick] The variable name 'chromaOklab' is ambiguous since the conversion is for Oklch; consider renaming it to 'chromaOklch' for clarity.
var (_, chromaOklab, _) = ConvertToOklchColor(color);
src/common/ManagedCommon/ColorFormatHelper.cs:616
- [nitpick] The variable name 'hueOklab' is misleading for an Oklch conversion; consider renaming it to 'hueOklch' to better reflect its purpose.
var (_, _, hueOklab) = ConvertToOklchColor(color);
There was a problem hiding this comment.
Pull Request Overview
This pull request adds support for new color spaces in the Color Picker utility by introducing formats for Oklab, Oklch, and a variant of CIELCh. Key changes include updated UI parameters in the color format editor, new enumeration entries and helper methods to convert colors to the CIELCh, Oklab, and Oklch representations, and updates to the visible color format mappings.
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/settings-ui/Settings.UI/SettingsXAML/Controls/ColorFormatEditor.xaml.cs | Updated color format parameter definitions to include new formats and adjusted ordering for CIELCh, Oklab, and Oklch. |
| src/settings-ui/Settings.UI.Library/Enumerations/ColorRepresentationType.cs | Added new enum entries for CIELCh, Oklab, and Oklch with corresponding value ranges. |
| src/settings-ui/Settings.UI.Library/ColorPickerProperties.cs | Extended the visible color format list to include the new formats. |
| src/modules/colorPicker/ColorPickerUI/ViewModels/ColorEditorViewModel.cs | Added new color format models for CIELCh, Oklab, and Oklch representations. |
| src/modules/colorPicker/ColorPickerUI/Helpers/ColorRepresentationHelper.cs | Implemented conversion methods for CIELCh, Oklab, and Oklch string representations (rounding values to two decimals). |
| src/common/ManagedCommon/ColorFormatHelper.cs | Introduced conversion functions for CIELCh, Oklab, and Oklch color models and updated the string formatting switch-case to support the new parameter tokens. |
Files not reviewed (1)
- src/settings-ui/Settings.UI/Strings/en-us/Resources.resw: Language not supported
Comments suppressed due to low confidence (2)
src/common/ManagedCommon/ColorFormatHelper.cs:345
- The conversion function for Oklch computes chroma as the square root of (chromaticity_a² + chromaticity_b²), but given the documented range of Oklch chroma is [0..0.5], verify whether the computed value needs to be clamped or scaled accordingly.
private static (double Lightness, double Chroma, double Hue) GetOklchColorFromOklab(double lightness, double chromaticity_a, double chromaticity_b)
src/settings-ui/Settings.UI/SettingsXAML/Controls/ColorFormatEditor.xaml.cs:54
- Ensure that the resource key 'Help_chromaticityACIE' (and similarly 'Help_chromaticityBCIE') used for the new CIELCh parameters matches the intended naming convention in the resource files for clarity and consistency.
new ColorFormatParameter() { Parameter = "%Ca", Description = resourceLoader.GetString("Help_chromaticityACIE") }
|
/azp run |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/azp run |
|
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I've removed the CIE LCh format from this PR because it would be better added in a separate PR, possibly along with changes to the CIE LAB & CIE XYZ calculation accuracy. All added tests pass now, so this PR is ready for review and merge. However, there is still the question of the representation format including commas. I'd appreciate any input on this detail.
|
|
The other parts of the code look good to me and have also passed local testing. |
Done, thanks! |
This comment has been minimized.
This comment has been minimized.
This comment was marked as resolved.
This comment was marked as resolved.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
2c853a4 to
e991fc7
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
* empowering users to maximize OOBE to their heart desire (#37823) empowering users to maximize to their heart desire * [Bug report] - Auto fill bug report parameters. (#37991) * [cmdpal] fix a broken link in README.md (#38714) related issue: #38713 * [cmdpal] Add Open URL fallback command for WebSearch ext (#38685) ## Summary of the Pull Request 1. Add new fallback command for websearch https://github.com/user-attachments/assets/39362d66-db59-42d4-b07c-7bfd60b2e420 ## PR Checklist - [x] **Closes:** #38497 --------- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * [CmdPal] Tray icon settings (#38672) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Added a settings to enable/disable the system tray icon (enabled by default). Adopter the term "system tray icon" for consistency with Windows 11 settings. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] **Closes:** #38407 * Add Zhiwei as part of PowerToys! (#38744) * Add Zhiwei as part of PowerToys! * Fix the expect.txt for Zhiwei * Fix the case problem on expect.txt zhiwei => Zhiwei * [PowerToysRun][Docs] Add QuickNotes to Third-Party plugins (#38663) * Add QuickNotes plugin to third-party Run plugins documentation * chore: add ruslanlap to spelling allow-list * chore: add ruslanlap to spelling allow-list * chore: add ruslanlap to spelling allow-list * Add ruslanlap to allowed names and remove from expected words list * Add securityContext to configuration files (#38017) For the winget DSC, Setting developer mode, installing Visual Studio 2022 & fetching and installing VS components all require elevation. Added securityContext: elevated for these resources. These configurations can now be invoked from user context, and will prompt for a single UAC to run resources that require elevation in a separate process. * Change log extension from .txt => .log (#33813) * Change log extension From .txt to .log * Also add workspace logs --------- Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> * [KeyboardManager] Fix modifier Key (Not right or left) stuck (#37930) * Fix ctr,alt,shift getting stuck * more changes * Update src/modules/keyboardmanager/common/Helpers.h Co-authored-by: Hao Liu <liuhaobupt@163.com> --------- Co-authored-by: Hao Liu <liuhaobupt@163.com> * "ǔ" changed to "ŭ" in GetDefaultLetterKeyEPO (#37791) * Fix Color Picker resource leak (#38122) (#38147) * Fix Color Picker resource leak (#38122) Added a using statement to properly dispose of the Graphics object created from the Bitmap. This fixes resource leak. * Fix CI complain * Update MouseInfoProvider.cs fix whitespace --------- Co-authored-by: Kai Tao <69313318+vanzue@users.noreply.github.com> * Upgrading some of the Testing framework items (#38779) * starting to get some of the baseline * Update NOTICE.md * Upgrading streamjson gets the others on same version of newtonsoft.json * Update PowerToys.Settings.csproj * Update NOTICE.md * upgrading to adjust fix vulnerability (#38784) * upgrading to adjust fix vulnerablitlity * Update NOTICE.md * Update NuGet packages in NOTICE.md * [PowerToysRun][Docs] Add Weather and Pomodoro to Third-Party plugins (#38760) * [PowerToysRun][Docs] Add Weather and Pomodoro to Third-Party plugins * [Spell-check] Add ruslanlap to allowed names and update expect.txt * Update expect.txt * Update names.txt * Update names.txt * Update names.txt * Update names.txt * [ColorPicker]Only close on escape if focused (#37895) * [cmdpal] Setting a new alias should remove the old one (#38193) * [cmdpal] Fix alias update * Fix the command palette extension alias update issue * clean code --------- Co-authored-by: vanzue <vanzue@outlook.com> * Apply security best practices for GitHub Actions / Dependency (#38552) This update aligns with Microsoft's security guidelines by pinning all GitHub Action tags and Docker tags to their full-length commits. This practice ensures immutability and reduces the risk of supply chain attacks. Note that 1st and 2nd party actions do not require hash pinning. * Rename the `[Ee]xts` dir to `ext` (#38852) **WARNING:** This PR will probably blow up all in-flight PRs at some point in the early days of CmdPal, two of us created seperate `Exts` and `exts` dirs. Depending on what the casing was on the branch that you checked one of those out from, it'd get stuck like that on your PC forever. Windows didn't care, so we never noticed. But GitHub does care, and now browsing the source on GitHub is basically impossible. Closes #38081 * Upgrading Boost dependencies (#38782) Upgrading Boost * upgrading toolkit + suppressing warnings (#38746) * upgrade toolkit to latest * supressing warnings * Update expect.txt making generic * Update suppression comments for AOT compatibility * Fix case for 'MVVMTK' in spell-check file * Update NOTICE.md * [CNF] Only enable experimental features if they exist (#37690) * [PowerRename] Add 12-hour time format patterns with AM/PM support (#30703) (#38723) * [PowerRename][Feature] Add new date/time formatting patterns to GetDatedFileName * [PowerRename][UI] Add date/time shortcut patterns to cheat sheet * [PowerRename][Tests] Add tests for new date/time formatting patterns * [PowerRename] [Refactor] Simplify AM/PM string handling in time patterns * [cmdpal] Fix empty file name issue when create new ext in "Create New Extension" command. (#38864) Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * [QuickAccent] Fix on-screen keyboard activation (#37581) * fix on-screen keyboard activation * cleanup * CmdPal: Add low-level keyboard hook for global hotkey (#38250) Adds the ability to make the global CmdPal hotkey a low-level hook. This is needed for `win+space`, `win+r`, et al. I've only added this to the root hotkey. Other hotkeys will still use the normal `RegisterHotkey` ones. We can re-evaluate this for 0.2+. Originally: zadjii-msft#349 Solves: #38297 --------- Co-authored-by: Mike Griese <migrie@microsoft.com> * Adds support for JUMBO thumbnails in the helper (#38539) Adds a parameter to `Toolkit.ThumbnailHelper.GetThumbnail` to retrieve the largest possible icon from the file. For most use cases, the normal icon size will be good for list items and page icons. But for details, you'll want to use the JUMBO icons, and to retrieve them, we need to get the icon from a different API. As a drive-by, I also have us fetching the highest-res app icon for UWP's rather than the lowest-res icon. Solves #38238 Screenshots: | before | after | | ------ | ----- | |  |  | |  |  | * [PowerToysRun] Add version info to plugin error messages (#38491) * changes * fix resx * Don't auto-hide when an MSAL dialog is opened on us (#38850) Apps that want to show MSAL dialogs on the Command Palette would explode if they passed CmdPal's HWND to WithParentActivityOrWindow. It's not entirely clear why, but MSAL would explode if the parent HWND is hidden. When the MSAL dialog opened, we'd hide ourselves, and badda bing, badda boom, the extension would crash. MSAL dialogs will set us to WS_DISABLED right before the dialog is opened. Easy solution. Don't hide ourselves, if we're disabled. Helps some friends not depend on the existence of Teams :P * Immediately select search text on opening page (#38842) closes #38712 closes #38315 related to #38379 (and might sufficiently close that too) This immediately selects the search text when a page is loaded.  * Update the settings form when ext settings are saved (#38851) This one was subtle - the Settings class in the toolkit didn't ever change the items for a SettingsContentPage. For the main settings window, this was problematic. It would only ever hang onto one instance of that CommandSettings.SettingsContentPage, and never re-retrieve the value from it. This fixes that issue, by making sure to raise an ItemsChanged in the settings changed handler, so that we automatically pull down the new settings forms. For settings that were added to commands, as a context item, this wasn't an issue. They were always returning new forms to the host, with the current settings values in it. Closes #38191 * Powertoys for Linear plugin added (#38883) * Update thirdPartyRunPlugins.md * Update names.txt --------- Co-authored-by: Clint Rutkas <clint@rutkas.com> * [cmdpal] Run cmdpalette from runner locally (#38725) * empowering users to maximize OOBE to their heart desire (#37823) empowering users to maximize to their heart desire * resume main * Trust selfsign cert in localmachine\root to make msix available * minor fix * retry signing --------- Co-authored-by: Clint Rutkas <clint@rutkas.com> * [cmdpal] Port v1 calculator extension (#38629) * init * update * Remove duplicated cp command * Change the long desc * Update notice.md * Use the same icon for fallback item * Add Rappl to expect list * update notice.md * Move the original order back. * Make Radians become default choice * Fix empty result * Remove unused settings. Move history back. Refactory the query logic * fix typo * merge main * CmdPal: minor calc updates (#38914) A bunch of calc updates * maintain the visibility of the history * add other formats to the context menu #38708 * some other icon tidying --------- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> Co-authored-by: Mike Griese <migrie@microsoft.com> * Add the list item requested shortcuts back (#38573) * [x] Re-adds the context menu shortcut text * [x] Hooks up the keybindings to the search box so that you can just press the keys while you have an item selected, and do a context command * [x] Hook these keybindings up to the context flyout itself * [x] Adds a sample for testing Solves #38271 * [CmdPal] A11y improvements (#38840) This PR introduces the following changes: - Adding the right a11y labels - as a result, Accesibility Insights is no longer flagging any errors: #38395 - Removing and tweaking a few animations, addressing: #38438 - Localization improvements * [CmdPalette > Time and Date] Custom formats (Port #37743) and other plugin improvements - 2 (#38952) * port changes from broken PR * fixes * fix formatting * [cmdpal] Add fallback item for system command. (#38865) * init * Remove unused cache * merge main --------- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * [CmdPal] Fixed #38961 (#38988) * [CmdPal] Fixed #38961 * [CmdPal] Fixed #38961 * [CmdPal] Fix #38961 Wrong Message for "Open Recycle Bin" Command * [CmdPal] Fix #38961 Wrong Message for "Open Recycle Bin" Command --------- Co-authored-by: Aung Khaing Khant <aungkhaingkhant@advent-soft.com> * [RegPreview] Init with header and add NEW button (#37626) * default value * add new button * fix tool tip * update button symbol * feedback changes * spellcheck * Fix build break because of miss Signing for new files (#39014) * Add CmdPalKeyboardService.dll as part of sign * Move 3rd party signing to another section * release: don't publish private symbols for 100 years (#39015) * [ImageResizer]Fix: Deleting an Image Resizer preset deletes the wrong preset (#38476) * [ImageResizer]Fix: Deleting an Image Resizer preset deletes the wrong preset * update the helper * sort items * [PowerAccent] Cancel previous ShowToolbar task if a new one is triggered (#37757) * Cancel previous ShowToolbar task if a new one is triggered * more changes * Fix space trigger starting at center * Removed unneded code * More changes * Addressed feedback * Fix another edge case * [cmdpal] Add setting "ignore hotkey when full screen" (#38923) * init * merge main * merge main --------- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * [Workspaces]Fix for steam games capture&launch: capture and correctly launch steam games. (#38380) * Workspaces fix: capture steam games. * minor fix * Launch steam apps by url appmodeluserid instead of directly exe call. * fix copilot comment * fix * remove unnecessary string * expect words * white list words * Order of alphabet * exclude thin frame if it's not a steam game. * fix build * fix regression * adjust comment * [Fuzzing] Add PowerRename Fuzzing and C++ Project Setup Guidance (#38922) * add fuzz * update solution * update pipeline * update solution * remove arm64 * use reference * revert the code * add fuzzing readme * update solution * fix spell-check * Parent reference don't need update * remove fuzzing config * add debug config * update the config * [CmdPal] Hide commands that shouldn't be visible (#39011) hide commands from more commands * [CmdPal] Tweaks to the detailspane UX (#38972) Details pane UX tweaks. Closes: #38973 Before:  After:  * [CmdPal] Better support for long labels in empty content and commandbar (#38974) Closes: #38970 Before: <img width="605" alt="image" src="https://github.com/user-attachments/assets/8310e08f-c471-4663-9000-bfd1eb8c99f3" /> After: <img width="514" alt="image" src="https://github.com/user-attachments/assets/b1e4c5f6-cd6b-42b2-9a23-3e1e3642202a" /> * CmdPal: Tidy up some winget experiences (#38174) I'm filing this so that I don't lose it on this machine I use less often. We can probably hold it out of 0.90 Fixes: * If a package is installed, we always display the version as "Unknown" * also deals with a case where getting the package metadata could fail, and we'd hide the list item. That's only possible in the "installed, no updates available" case * Allow package updates, add an icon for updates * moves off the preview winget API onto a higher stable version * Fully initialize context menus when they change (#38998) If we don't slow-initialize the whole menu when it changes, then we won't see that there's secondary (& more) commands. Tested this with the extension from [waaverecords/CmdPal.Ext.Spotify#4](waaverecords/CmdPal.Ext.Spotify#4) Closes #38959 Also seemingly closes #38347 - seems that needed additional bumping of the `EmptyContent`'s * Pre-creation of generated folder for any csproj (#39018) * Test for Precreation of generated folder for any csproj to prevent random build break * Update to WinAppSDK 1.7 latest version (#39016) * Update to WinAppSDK 1.7 latest version * Update UpdateVersions.ps1 Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> Co-authored-by: Dustin L. Howett <dustin@howett.net> Co-authored-by: Shawn Yuan <128874481+shuaiyuanxx@users.noreply.github.com> Co-authored-by: Shawn Yuan <shuai.yuan.zju@gmail.com> Co-authored-by: Clint Rutkas <clint@rutkas.com> * upgrade the boost dependencies for Fuzzing Project (#39057) * [CmdPal] Added fallback for time and date (#38918) * Added fallback for time and date Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * only support week/now/time/year query Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * Add week option Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * Changed setting for time date fallback. Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * update globalization string Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * use week of year. Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * update Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> --------- Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * [cmdpal] Ref to AotCompatibility in some cmdpal project. (#39061) * Ref to AotCompatibility * Typo issue --------- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * [Settings] Fix null CmdPal HotKey crash (#39052) fixed null cmdpal hotkey crash when settings.json not exists or not define hotkey * Add support for filterable, nested context menus (#38776) _targets #38573_ At first I just wanted to add support for nested context menus. But then I also had to add a search box, so the focus wouldn't get weird. End result:  This gets rid of the need to have the search box and the command bar both track item keybindings - now it's just in the command bar. Closes #38299 Closes #38442 * [Tool] Script to build an installer locally (#39017) * add script to build a installer * minor fix * fix search path for msix file * fix sign * fix sign * fix spelling * Fix powershell5 can't recognize emoji * ensure-wix * bring cmdpal available during local build * remove early quit * fix marco * add logger * doc * add a note * self review * fix macro def * add functionality to export cert so that other machine can install it. * spelling * 37405 Advanced Paste: Image To Text doesn't work with English (Canada) (#37806) * [AdvancedPaste] [Fix Bug] Create ocrEngine from user profile language GetOCRLanguage may fail based on language tag not matching (en-CA does not match en-GB or en-US), however user profile language may be valid. * Update exception message. Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * update Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> --------- Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> Co-authored-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * Color Picker: add Oklab and Oklch color formats (#38052) * Resolve Resources.resw conflict * Update CIE LCh chroma practical upper bound according to CSS spec * Add review suggestions * Add WIP tests (lch and oklch do not pass yet) * Deduplicate Lab to LCh converter method * Update expect.txt * Fix liberty test color * Reimplement oklab with better precision * Remove CIE LCh * Add tooltip for color param descriptions * Update spell-check expect.txt with new words * Remove 'cielch' and 'lch' from expect.txt --------- Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> Co-authored-by: Clint Rutkas <clint@rutkas.com> Co-authored-by: Shawn Yuan <128874481+shuaiyuanxx@users.noreply.github.com> * [PTRun] Allow preventing usage based ordering results (#37491) * Allow preventing selected result data retrieval * Updated implementation to calculate sort order on result and update property name to better reflect purpose * Update Result.cs sort order method name Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> * Align with the name GetSortOrderScore --------- Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> * [cmdpal] [AOT] make Clipboard/System/WebSearch/WindowsSettings ext become AOT compatible. (#39080) Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * Update the ADO path for tsa.json (#39079) The previous ADO area path for Powertoys was gone, we need to update to new one. * Start progress on AoT. (#39051) * starting AoT flag push * Few more * bookmarks * Really? The VM project compiles? * Disable publish AOT before we really testing it. --------- Co-authored-by: Mike Griese <migrie@microsoft.com> Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * [CmdPal] Launch cmd pal with retry (#39039) * Add Retry when enable * Add correct for the checking logic * Retry in another thread (#39042) * launch thread * dev * fix a thread safety * improve * improve * make code clear * Fix comment * fix comment * improve * self review * fix & log * silent fail if not reach 10 times * fix a ci build flag error * fix a macro * some simple improve --------- Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> * [cmdpal][aot] Remove some unused file in CmdPal.Common and mark it as AOT compatible. (#39110) * Remove unused com interface * Remove unused file * Remove unused file * Remove unused file --------- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * Wait to update SearchText until we've actually updated SearchText (#39093) Closes #38829 If we always UpdateProperty here, then there's a possible race condition, where we raise the PropertyChanged(SearchText) before the subclass actually retrieves the new SearchText from the model. In that race situation, if the UI thread handles the PropertyChanged before ListViewModel fetches the SearchText, it'll think that the old search text is the _new_ value. * [Tool] Delete export pfx function to remove use of hard coded password (#39144) don't need export pfx functionality * [cmdpal] Support search any file in fallback command (#38455) ## Summary of the Pull Request 1. Add new setting to control this behaviour 2. Support always on and only when file exist in the fallback command 3. Change the condition of updateFallbackCommand in toplevelvm demo: https://github.com/user-attachments/assets/19e4ced3-30ad-44f4-8f3a-93620f46bb3d ## PR Checklist - [x] **Closes:** #38370 --------- Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> Co-authored-by: Mike Griese <migrie@microsoft.com> * [cmdpal][AOT] clean up some AOT related issue (#39163) Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * Fix for missing CmdPal extensions docs (#39173) * CmdPal: Start extensions in parallel (#39203) This reduces our extension startup time by approximately 70% on my machine (I have 17 extensions). I'd guess the gains scale with the number of extensions. That's 8s -> 3s on average, and now I also get 2.5s reloads. This retains the order of the list of extensions, by only starting the processes in parallel. Once we have all the command provider instances, then actually retrieving the commands. It also adds a timeout on startup & load, so that one misbehaving extension won't block everyone else. closes: #38529 * [Infra-BuildScript] Add PowerShell Script to Enforce Shared Common.Dotnet.CsWinRT.props in all CSharp Projects under Src Sub-Folder (#37811) * Add Powershell script to validate whether CSharp project correctly import shared props, update pipeline to enforce such validation, and fixed all projects that didn't import this shared props correctly * add common props for fuzz test project * update the path * Only scans projects in src sub-folder * Update .pipelines/verifyCommonProps.ps1 * Update csproj to include Common.Dotnet.CsWinRT.props * Fix indentation in RegistryPreview.FuzzTests.csproj * exclude TemplateCmdPalExtension.csproj in validation process * exclude TemplateCmdPalExtension.csproj in validation process --------- Co-authored-by: Leilei Zhang <leilzh@microsoft.com> Co-authored-by: Jerry Xu <nxu@microsoft.com> * Dismiss the details pane when the list gets emptied (#39206) I cannot find an issue for this. I swear I filed it somewhere. If you open winget, search for "terminal", wait till it loads, then hit `esc`, we'll clear the search and empty the list, but never actually hide the details pane. That looks weird. This fixes that. Closes _nothing i guess_. * cmdpal: unset the command if we don't find a command (#39208) On a reload, the system commands fallback would leave the "restart" fallback behind, for the same reason as what we found around e40372c & ef264d9 in #38455 * cmdpal: fix a leak in the extension template (#39209) There's apparently a footgun with the way we're using ComServer, which results in us leaking the extension processes when we think we've disposed them The fix unfortunately has to be on the extension side. Extensions published prior to 0.2 will need to manually fix this. closes: #39045 * [CmdPal] Prevent maximizing (#39220) Prevent CmdPal window from maximizing when user double-click the title bar area. Closes: #39096 * [CmdPal] MinWidth/Height and DPI-aware launch dimensions (#38637) * MinWidth/Height and DPI-aware launch dimensions * Making MainWindow DPI aware too * Moving toastwindow to WinUIEx too * Update MainWindow.xaml.cs * Reverting back to the working logic * Localizing settings window title * Xaml formatting * Update SettingsWindow.xaml.cs * CmdPal: Cloak the window instead of hiding it (#39170) This avoids the few frames of "flicker in" that XAML does when the window is SW_SHOW'n closes #38384 closes #38404 closes #38438 * Lazy-fetch the settings for extensions (#38844) This PR stops us from synchronously initializing the settings page for every extension (including built-in's) on startup. That incurs a small penalty that really adds up the more extensions a user has. Instead, we'll now only initialize the `CommandSettings` object when we first actually need it. From a relatively unscientific test, this saves approximately 10% on the initialization of builtin commands, and for my setup, it trims about 28% off extension initialization (across all built-in's / extensions): branch | Built-in load (ms) | Extension load (ms) | %Δ builtin | %Δ extensions | -- | -- | -- | -- | -- | main | 1455 | 6867.6 | | | this PR | 1309.2 | 4919 | -10.02% | -28.37% Closes #38321 * [cmdpal] protect cmdpal from crash if adaptive card fails (#39264) <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Card = AdaptiveCard.FromJsonString(cardJson) is called in catch block, if it fails, app will crash. * CmdPal: URI activate, rather than using shell:AppsFolder (#39269) * Use a URI handler for launching this is a test * I think we can review this * Add a settings URI too * [CmdPal] Open CmdPal settings from PT settings (#39262) * Turning description into a hyperlink * Update expect.txt * Update CmdPalPage.xaml.cs * update xaml format. Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * update. Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * Added logger Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> * update Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> --------- Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> Co-authored-by: Shawn Yuan <shuai.yuan.zju@gmail.com> Co-authored-by: Shawn Yuan <shuaiyuan@microsoft.com> * CmdPal: Actually observe Details (#39263) Extensions can change the properties on their Details, and they should be observable, but they weren't. This is because the ShellPage is ultimately responsible for exposing the details, but it doesn't own the details. The selected ListItemViewModel from the ListPage does. This PR just adds a event handler on ListViewModel. We'll attach/detach that handler to ListItemViewModels as the selection changes. In the body of that handler, we'll let the ShellPage know when the details object changes (by sending ShowDetails/HideDetails messages). Closes #39216 * Bump toolkit version to 0.2.0 in template (#39292) This bumps the version of the toolkit consumed by the template to 0.2.0 ~Ironically, I have not yet published 0.2. I'm spinning that CI build currently. But I'll have that uploaded tomorrow morning at the latest~ EDIT: package is uploaded now * Remove new label from command palette (#39318) * remove new label from cmdpal * fix xaml styling * Fix settings crash issue when clicking "Open Cmdpal settings..." (#39322) Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * [cmdpal] Disable "ignore shortcut when full screen" by default (#39323) disable by default Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * [cmdpal] Fix winget cannot install after clicking "install" button issue (#39324) init Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> * [Fuzzing test] Use valid areaPath in OneFuzz configuration (#39368) change areaPath for fuzzing test config * Add log for cmd pal ext to trace exceptions (#39326) * Add log to trace error for apps. * Add bookmark log * registry exception log * fix * Added logger for cmdpal extensions. Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * remove noise * Update Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * change log level * change level * Fix comments * Fixed comments. Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> * Resolve comments Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> --------- Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> Co-authored-by: Shawn Yuan <shuaiyuan@microsoft.com> * release: stop hardcoding version numbers for the telemetry package (#39390) * Update Areapath in tsa.json to align latest one (#39391) * [cmdpal] Add some logs for WinGet extension (#39329) * [Fuzzing test] Use valid areaPath in OneFuzz configuration (#39393) * Bump our telemetry package version (#39388) Data collection is hard. Our internal package, which was last bumped around August 2024, mistakenly changed a load bearing string from `ETW_GROUP` to `MSPG_GROUP`. The former sets the ETW group id. The later does nothing. This PR represents bumping our dependency to the version with the fix. Considering that none of our data for CmdPal worked anyways, I took the opportunity to rename a bunch of our events that had totally generic names. Closes #38704 re: #38032 regressed around: #34078 * [Deps] Update .NET packages from 9.0.4 to 9.0.5 (#39404) Updates .NET 9 Runtime / Library packages to the latest 9.0.5 servicing release for security fixes. This PR also updates the version of System.Text.Json to 9.0.5 in the CmdPal extension template. * [Fuzz] Add DLL Reference in OneFuzzConfig.json to Fix Hosts Fuzz Bug (#39398) * add Testably.Abstractions.FileSystem.Interface.dll * fix spell error --------- Signed-off-by: Shawn Yuan <shuai.yuan.zju@gmail.com> Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com> Co-authored-by: Clint Rutkas <clint@rutkas.com> Co-authored-by: Laszlo Nemeth <57342539+donlaci@users.noreply.github.com> Co-authored-by: RokyZevon <12629919+RokyZevon@users.noreply.github.com> Co-authored-by: Yu Leng <42196638+moooyo@users.noreply.github.com> Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com> Co-authored-by: Davide Giacometti <25966642+davidegiacometti@users.noreply.github.com> Co-authored-by: Gordon Lam <73506701+yeelam-gordon@users.noreply.github.com> Co-authored-by: ruslanlap <106077551+ruslanlap@users.noreply.github.com> Co-authored-by: Muhammad Danish <mdanishkhdev@gmail.com> Co-authored-by: Bennett Blodinger <benwa@users.noreply.github.com> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com> Co-authored-by: Ionuț Manța <ionut@janeasystems.com> Co-authored-by: Hao Liu <liuhaobupt@163.com> Co-authored-by: OlegHarchevkin <40352094+OlegKharchevkin@users.noreply.github.com> Co-authored-by: dcog989 <89043002+dcog989@users.noreply.github.com> Co-authored-by: Kai Tao <69313318+vanzue@users.noreply.github.com> Co-authored-by: PesBandi <127593627+PesBandi@users.noreply.github.com> Co-authored-by: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Co-authored-by: vanzue <vanzue@outlook.com> Co-authored-by: Typpi <20943337+Nick2bad4u@users.noreply.github.com> Co-authored-by: Mike Griese <migrie@microsoft.com> Co-authored-by: Carlos Zamora <carlos.zamora@microsoft.com> Co-authored-by: Abhyudit <64366765+bitmap4@users.noreply.github.com> Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com> Co-authored-by: Ved Nig <vednig12@outlook.com> Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Aung Khaing Khant <aungkhaingkhant.dev@gmail.com> Co-authored-by: Aung Khaing Khant <aungkhaingkhant@advent-soft.com> Co-authored-by: Dustin L. Howett <duhowett@microsoft.com> Co-authored-by: leileizhang <leilzh@microsoft.com> Co-authored-by: Dustin L. Howett <dustin@howett.net> Co-authored-by: Shawn Yuan <128874481+shuaiyuanxx@users.noreply.github.com> Co-authored-by: Shawn Yuan <shuai.yuan.zju@gmail.com> Co-authored-by: cryolithic <cryolithic@gmail.com> Co-authored-by: Lemonyte <49930425+lemonyte@users.noreply.github.com> Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> Co-authored-by: Corey Hayward <72159232+CoreyHayward@users.noreply.github.com> Co-authored-by: Jerry Xu <n.xu@outlook.com> Co-authored-by: Jerry Xu <nxu@microsoft.com> Co-authored-by: Shawn Yuan <shuaiyuan@microsoft.com> Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com> Co-authored-by: Jeremy Sinclair <4016293+snickler@users.noreply.github.com> Co-authored-by: Mengyuan <162882040+chenmy77@users.noreply.github.com> Co-authored-by: Xiaofeng Wang (from Dev Box) <xiaofengwang@microsoft.com>
* Resolve Resources.resw conflict * Update CIE LCh chroma practical upper bound according to CSS spec * Add review suggestions * Add WIP tests (lch and oklch do not pass yet) * Deduplicate Lab to LCh converter method * Update expect.txt * Fix liberty test color * Reimplement oklab with better precision * Remove CIE LCh * Add tooltip for color param descriptions * Update spell-check expect.txt with new words * Remove 'cielch' and 'lch' from expect.txt --------- Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com> Co-authored-by: Clint Rutkas <clint@rutkas.com> Co-authored-by: Shawn Yuan <128874481+shuaiyuanxx@users.noreply.github.com>


Summary of the Pull Request
This pull request adds support for the Oklab color space to the Color Picker utility.
It adds a format for Oklab, as well as the cylindrical model representation (polar coordinate form) of Oklab called Oklch.
What this PR does not do
This PR does not internally change how colors are represented, though this may be desirable for a future PR, specifically in the "color variations" bar of the Color Picker UI to ensure constant lightness between hues.
Also, this PR does not add a cylindrical mode representation of CIE LAB (called CIE LCh).
PR Checklist
Detailed Description of the Pull Request / Additional comments
The canonical capitalization of Oklab and Oklch as used by Björn Ottosson is inconsistent with CIE Lab and CIE LCh (also styled as CIELAB and CIELCH).
The CSS color spec for
oklabandoklchdoes not allow commas in the color expression, so if the formats are primarily intended for CSS copy-paste, they should be represented asoklab(L a b)andoklch(L C h)without commas.Also, in the CSS spec the CIELAB and CIELCH color functions are simply
lab(L a b)andlch(L C h)respectively, without the leadingCIE.CIE Lab lightness values range from 0 to 100, while Oklab lightness ranges from 0 to 1. In CSS it is more often represented as a percentage with two decimal places, which looks similar to CIE Lab representation. Right now the implementation follows the canonical 0 to 1 representation, but it may be worth updating for consistency.
Existing configuration files seem to prevent the settings UI and color picker UI from showing the new formats. In testing, I removed my existing configuration files from a regular PowerToys installation in order for the changes to show up. I presume the configuration must be migrated somehow but I don't know how to do this.
The help text for creating new color formats has become a little more verbose and now doesn't fit into the dialog modal. It may be worth shortening the help text, or otherwise updating the UI in a separate PR.

Validation Steps Performed