Repository navigation
fix(design-system): derive a valid color for every icon name - #3585
Merged
Merged
Conversation
dschmidt
added a commit
to opencloud-eu/web-extensions
that referenced
this pull request
Oct 7, 2026
Without a color, the application icon of the host derives one from the icon name. Before opencloud-eu/web#3585 that throws while rendering for about one icon name in nine, which takes the whole dashboard or app menu with it. Until the app can rely on that fix it derives the color itself, the same way the fixed host does, and passes it for dashboard tiles and app menu items.
generateHashedColorForString did not pad its hex value, so a name whose hash has leading zeros gave fewer than six digits, hexToRgb returned null and the contrast calculation threw. setDesiredContrastRatio also recursed forever for a dark color it cannot brighten in one percent steps. Both break the application icon without a primary color, which derives one from the icon name: of the 1681 names in the icon set, 155 hit the first problem and 40 the second.
openclouders
pushed a commit
that referenced
this pull request
Oct 8, 2026
fix(design-system): derive a valid color for every icon name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
oc-application-iconwithout acolorPrimaryderives a color from the icon name. For a number of icon names that throws while rendering, which takes the surrounding component with it. I ran into it with a dashboard of the external sites app that stayed blank because one site used the iconkeywithout a color.Two causes in
helpers/colors.ts:generateHashedColorForStringdid not pad its hex value. A name whose hash has leading zeros gives fewer than six digits (keygives#19E5F),hexToRgbreturnsnullfor it, and the contrast calculation throws onnull.setDesiredContrastRatiorecurses until the ratio is within reach. It shades by one percent per step, which does not change a small channel value after rounding and cannot raise a channel above 255. For a dark color it should brighten, no channel moves, and it recurses until the stack overflows (bellgives#2E1503).Of the 1681 icon names in the icon set, 155 hit the first problem and 40 the second.
The fix:
setDesiredContrastRatioreturn the color as it is once a shading step no longer changes it.Colors that worked before are unchanged (
bookis still#2e71ff,grid#308b46). With the fix all 1681 names give a valid color.Related Issue
None.
How Has This Been Tested?
oc-application-iconover every icon name inpackages/design-system/src/assets/iconskey,upload,at) and for the two ways the contrast adjustment gets stuck (no channel can move, the only moving channel reaches 255)Types of changes