Skip to content

Commit

Permalink
fix(themes): properly convert signed ints to hex (#8)
Browse files Browse the repository at this point in the history
processColor returns signed ints representing the colour. without the `>>> 0`converting to unsigned while preserving 2s compliment the function could return insane values.

ex:
#ffffff -> #-1
  • Loading branch information
Covkie authored Jan 25, 2025
1 parent 8fc2ef6 commit c55cd82
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utilities/withoutOpacity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { processColor, type ColorValue } from 'react-native';
* @returns The color provided as a hex string without opacity.
*/
function withoutOpacity(color: number | ColorValue): string {
const processed = processColor(color).toString(16);
const processed = (Number(processColor(color)) >>> 0).toString(16);

return '#' + processed.slice(-6);
}
Expand Down

0 comments on commit c55cd82

Please sign in to comment.