An ATproto social media client -- with an independent Appview.
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: more colour methods

serenity a6d387cf d1e3d083

+17 -6
+10 -4
src/alf/util/colors/conversion.ts
··· 89 89 } 90 90 } 91 91 92 - const r = hue(h + 1 / 3) * 255 93 - const g = hue(h) * 255 94 - const b = hue(h - 1 / 3) * 255 92 + const r = Math.round(hue(h + 1 / 3) * 255) 93 + const g = Math.round(hue(h) * 255) 94 + const b = Math.round(hue(h - 1 / 3) * 255) 95 95 96 - return `${appendSymbol ? '#' : ''}${r.toString(16)}${g.toString(16)}${b.toString(16)}${typeof a !== 'undefined' ? a.toString(16) : ''}` 96 + return `${appendSymbol ? '#' : ''}${r.toString(16)}${g.toString(16)}${b.toString(16)}${typeof a !== 'undefined' ? Math.round(a).toString(16) : ''}` 97 97 } 98 98 99 99 /** ··· 215 215 a: typeof a !== 'undefined' ? (a / 100) * 255 : undefined, 216 216 } 217 217 } 218 + 219 + export const rgbObjectToString = ({r, g, b, a}: RgbColor) => { 220 + const res = `rgba(${r}, ${g}, ${b}${a ? `, ${(a / 255) * 100}` : ''})` 221 + console.log(res) 222 + return res 223 + }
+7 -2
src/alf/util/colors/index.ts
··· 1 - import {hexToHsl, hslToHex} from '#/alf/util/colors/conversion' 1 + import { 2 + hexToHsl, 3 + hslToHex, 4 + hslToRgb, 5 + rgbObjectToString, 6 + } from '#/alf/util/colors/conversion' 2 7 3 8 export interface HslColor { 4 9 h: number ··· 57 62 58 63 hsl.a = amount / 100 59 64 hsl.a = clamp(hsl.a) 60 - return hslToHex(hsl) 65 + return rgbObjectToString(hslToRgb(hsl)) 61 66 }