-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature[kudos-community-www]: new homepage
- Loading branch information
Showing
14 changed files
with
577 additions
and
169 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script> | ||
import { colorizer, defaultPalette } from '$lib/utils/colorizer'; | ||
export let type = ''; | ||
export let pallette = defaultPalette; | ||
export let bg = ''; | ||
export let colorize = true; | ||
export { klass as class }; | ||
let klass = ''; | ||
</script> | ||
|
||
<span | ||
title={`${type}`} | ||
on:click | ||
class={`flex h-5 cursor-pointer flex-row flex-nowrap items-center justify-center text-ellipsis whitespace-nowrap rounded-full border-2 border-white px-1.5 py-1 text-center font-mono text-xs font-thin lowercase tracking-tighter text-white md:h-6 ${klass}`} | ||
style={`background-color:${colorize ? colorizer(type, pallette) : bg}; font-size: 0.6rem;`} | ||
> | ||
<slot /> | ||
</span> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import colors from 'tailwindcss/colors'; | ||
import stringHash from 'string-hash'; | ||
|
||
export const defaultPalette = [ | ||
'#3366CC', | ||
'#DC3912', | ||
'#FF9900', | ||
'#109618', | ||
'#990099', | ||
'#3B3EAC', | ||
'#0099C6', | ||
'#DD4477', | ||
'#66AA00', | ||
'#FF0099', | ||
'#B82E2E', | ||
'#316395', | ||
'#994499', | ||
'#22AA99', | ||
'#AACA51', | ||
'#6633CC', | ||
'#F67370', | ||
'#8B0707', | ||
'#329262', | ||
'#5574A6', | ||
'#3B3EAC' | ||
]; | ||
|
||
[ | ||
'red', | ||
'blue', | ||
'green', | ||
'yellow', | ||
'pink', | ||
'amber', | ||
'purple', | ||
'sky', | ||
'indigo', | ||
'rose', | ||
'slate' | ||
].forEach((color) => { | ||
Object.values(colors[color]).forEach((value, index) => { | ||
if (index > 2 && index < 9 && index % 2 === 0) { | ||
// console.log(index, color, value); | ||
defaultPalette.push(value); | ||
} | ||
}); | ||
}); | ||
|
||
// for any text, always return a consistent color | ||
export function colorizer(name: string, palette: string[] = defaultPalette) { | ||
name = (name || '??').toLowerCase(); | ||
// console.log((Math.abs(stringHash(name)) % palette.length), stringHash(name), name, palette.length); | ||
return palette[stringHash(name) % palette.length]; | ||
} |
Oops, something went wrong.