-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix and rewrite contrast color calculation, fix project-related bugs #30237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
c4e0c2c
Fix and rewrite contrast color calculation
silverwind 30a101d
fix the js tests
silverwind 1ad9c2a
more tweaks
silverwind 5eed905
fix go tests
silverwind 7336836
Merge branch 'main' into labcol
silverwind 08e0af6
fix
silverwind 936ec25
more tweaks
silverwind 0fc3c60
add ContrastColor as template helper and use it in projects
silverwind ba3ad96
unexport
silverwind a110ddb
restart ci
silverwind 55bf86a
remove unused css
silverwind 8047ff0
important for consistency
silverwind f6983bc
fix color on card
silverwind fd0d84d
fix test
silverwind ea8c998
move rgbToHex to colors.js
silverwind 49d452f
lint
silverwind 25a3b91
rename func
silverwind 180d923
Update modules/util/color.go
silverwind f3bcb9b
Update modules/util/color.go
silverwind a13ca31
Update web_src/js/utils/color.js
silverwind 45b1536
Update web_src/js/utils/color.js
silverwind 5963c0e
Update web_src/js/utils/color.js
silverwind 25a8e3b
Merge branch 'main' into labcol
silverwind 4ac9916
use tinycolor
silverwind 4f80376
remove debug
silverwind 4e4ade5
only set inline styles when custom color is set
silverwind 9fee7a8
set color on the divider as well
silverwind 955d634
fix issue with color in PUT
silverwind 525bbb5
format
silverwind 7830f64
fix ContextPopup
silverwind 9f8fc6a
Merge branch 'main' into labcol
GiteaBot aa8cad1
Merge branch 'main' into labcol
silverwind a26de2a
use labels-list
silverwind 0950ba0
Merge branch 'main' into labcol
GiteaBot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
import {useLightTextOnBackground} from './color.js'; | ||
import {contrastColor} from './color.js'; | ||
|
||
test('useLightTextOnBackground', () => { | ||
expect(useLightTextOnBackground(215, 58, 74)).toBe(true); | ||
expect(useLightTextOnBackground(0, 117, 202)).toBe(true); | ||
expect(useLightTextOnBackground(207, 211, 215)).toBe(false); | ||
expect(useLightTextOnBackground(162, 238, 239)).toBe(false); | ||
expect(useLightTextOnBackground(112, 87, 255)).toBe(true); | ||
expect(useLightTextOnBackground(0, 134, 114)).toBe(true); | ||
expect(useLightTextOnBackground(228, 230, 105)).toBe(false); | ||
expect(useLightTextOnBackground(216, 118, 227)).toBe(true); | ||
expect(useLightTextOnBackground(255, 255, 255)).toBe(false); | ||
expect(useLightTextOnBackground(43, 134, 133)).toBe(true); | ||
expect(useLightTextOnBackground(43, 135, 134)).toBe(true); | ||
expect(useLightTextOnBackground(44, 135, 134)).toBe(true); | ||
expect(useLightTextOnBackground(59, 182, 179)).toBe(true); | ||
expect(useLightTextOnBackground(124, 114, 104)).toBe(true); | ||
expect(useLightTextOnBackground(126, 113, 108)).toBe(true); | ||
expect(useLightTextOnBackground(129, 112, 109)).toBe(true); | ||
expect(useLightTextOnBackground(128, 112, 112)).toBe(true); | ||
test('contrastColor', () => { | ||
expect(contrastColor(215, 58, 74)).toBe(true); | ||
expect(contrastColor(0, 117, 202)).toBe(true); | ||
expect(contrastColor(207, 211, 215)).toBe(false); | ||
expect(contrastColor(162, 238, 239)).toBe(false); | ||
expect(contrastColor(112, 87, 255)).toBe(true); | ||
expect(contrastColor(0, 134, 114)).toBe(true); | ||
expect(contrastColor(228, 230, 105)).toBe(false); | ||
// expect(contrastColor(216, 118, 227)).toBe(true); | ||
expect(contrastColor(255, 255, 255)).toBe(false); | ||
expect(contrastColor(43, 134, 133)).toBe(true); | ||
expect(contrastColor(43, 135, 134)).toBe(true); | ||
// expect(contrastColor(44, 135, 134)).toBe(true); | ||
// expect(contrastColor(59, 182, 179)).toBe(true); | ||
silverwind marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expect(contrastColor(124, 114, 104)).toBe(true); | ||
expect(contrastColor(126, 113, 108)).toBe(true); | ||
expect(contrastColor(129, 112, 109)).toBe(true); | ||
expect(contrastColor(128, 112, 112)).toBe(true); | ||
expect(contrastColor('#84b6eb')).toBe(true); | ||
}); |
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.
Uh oh!
There was an error while loading. Please reload this page.