Skip to content

Commit 09f04b6

Browse files
authored
Retro theme (#16)
* Added retro decorations and retro preset theme * reverted to double quotes to single quotes * Applied ESLint * Added retro theme
1 parent 8822810 commit 09f04b6

3 files changed

Lines changed: 100 additions & 7 deletions

File tree

src/OGCard.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Rating } from './rating'
22
import { preset, type Theme } from './theme'
33
import { GitRollLogo } from './logo'
4-
import { KawaiiCatDecoration } from './decorations'
4+
import { KawaiiCatDecoration, RetroThemeDecoration } from './decorations'
55

66

77
export interface OGCardProps {
@@ -26,7 +26,7 @@ export function OGCard({
2626
reliabilityScore, securityScore, maintainabilityScore,
2727
contributor,
2828
regionalRank, campusRank,
29-
theme = preset.light
29+
theme = preset.light,
3030
}: OGCardProps) {
3131
const bg = theme.badgeColors[overallRating] ?? theme.badgeColors[Rating.E]
3232
return (
@@ -46,6 +46,9 @@ export function OGCard({
4646
{theme === preset.kawaiiCat && (
4747
<KawaiiCatDecoration color={theme.barForeground} />
4848
)}
49+
{theme === preset.retro && (
50+
<RetroThemeDecoration color={theme.barForeground} />
51+
)}
4952
<GitRollLogo fill={theme.logoColor} />
5053
<div
5154
style={{

src/decorations.tsx

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
interface KawaiiCatDecorationProps {
22
color: string
33
}
4-
4+
interface RetroThemeDecorationProps {
5+
color: string
6+
}
57
export function KawaiiCatDecoration({ color }: KawaiiCatDecorationProps) {
68
return (
79
<svg
@@ -59,3 +61,63 @@ export function KawaiiCatDecoration({ color }: KawaiiCatDecorationProps) {
5961
</svg>
6062
)
6163
}
64+
65+
export function RetroThemeDecoration({ color }: RetroThemeDecorationProps) {
66+
return (
67+
<svg
68+
width='1200'
69+
height='675'
70+
viewBox='0 0 1200 675'
71+
style={{
72+
position: 'absolute',
73+
top: 0,
74+
left: 0,
75+
pointerEvents: 'none',
76+
overflow: 'visible',
77+
}}
78+
>
79+
{/* Retro-style grid background */}
80+
<defs>
81+
<pattern
82+
id='retro-grid'
83+
width='40'
84+
height='40'
85+
patternUnits='userSpaceOnUse'
86+
>
87+
<path
88+
d='M 40 0 L 0 0 0 40'
89+
fill='none'
90+
stroke={color}
91+
strokeWidth='0.5'
92+
opacity='0.8'
93+
/>
94+
</pattern>
95+
</defs>
96+
<rect width='1200' height='675' fill='url(#retro-grid)' />
97+
{/* Stars */}
98+
<g fill={color} opacity='0.5'>
99+
{[
100+
// Stars on Top-left of logo
101+
[90, 60, 0.8],
102+
[66, 69, 0.8],
103+
[58, 95, 0.8],
104+
].map(([x, y], i) => (
105+
<path
106+
key={i}
107+
transform={`translate(${x}, ${y}) scale(0.8)`}
108+
d='M10 0 L13 7 L21 7 L15 13 L17 21 L10 17 L3 21 L5 13 L-1 7 L7 7Z'
109+
fill={color}
110+
/>
111+
))}
112+
{/* Dotted border lines */}
113+
<path
114+
d='M80 20 H1120 M80 655 H1120'
115+
stroke={color}
116+
strokeWidth='2'
117+
strokeDasharray='6 6'
118+
opacity='0.5'
119+
/>
120+
</g>
121+
</svg>
122+
)
123+
}

src/theme.ts

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ const midnight = {
227227
barForeground: '#ecf0f1',
228228
borderColor: '#34495e',
229229
avatarPlaceholderColor: '#7f8c8d',
230-
logoColor: '#ecf0f1'
230+
logoColor: '#ecf0f1',
231231
}
232232

233233
const kawaiiCat = {
@@ -240,15 +240,15 @@ const kawaiiCat = {
240240
[Rating.B]: '#66B2B2',
241241
[Rating.C]: '#80BFBF',
242242
[Rating.D]: '#99CCCC',
243-
[Rating.E]: '#B3D9D9',
243+
[Rating.E]: '#B3D9D9'
244244
},
245245
badgeTextColors: {
246246
[Rating.S]: '#7A5C58',
247247
[Rating.A]: '#7A5C58',
248248
[Rating.B]: '#FFFFFF',
249249
[Rating.C]: '#FFFFFF',
250250
[Rating.D]: '#7A5C58',
251-
[Rating.E]: '#7A5C58',
251+
[Rating.E]: '#7A5C58'
252252
},
253253
barBackground: '#FFCAD4',
254254
barForeground: '#66B2B2',
@@ -257,6 +257,33 @@ const kawaiiCat = {
257257
logoColor: '#FFCAD4',
258258
}
259259

260+
const retro = {
261+
backgroundColor: '#240046',
262+
textColor: '#f2ebfb',
263+
textColorSecondary: 'rgba(255, 255, 255, 0.6)',
264+
badgeColors: {
265+
[Rating.S]: '#fbe300',
266+
[Rating.A]: '#9cf945',
267+
[Rating.B]: '#4cc9f0',
268+
[Rating.C]: '#9d4edd',
269+
[Rating.D]: '#f72585',
270+
[Rating.E]: '#ff6200',
271+
},
272+
badgeTextColors: {
273+
[Rating.S]: '#240046',
274+
[Rating.A]: '#240046',
275+
[Rating.B]: '#240046',
276+
[Rating.C]: '#240046',
277+
[Rating.D]: '#240046',
278+
[Rating.E]: '#240046',
279+
},
280+
barBackground: '#F4F4F5',
281+
barForeground: '#9d4edd',
282+
borderColor: '#E4E4E7',
283+
avatarPlaceholderColor: '#9ca3af',
284+
logoColor: '#ebd9fc',
285+
}
286+
260287
export const preset: Record<string, Theme> = {
261288
light,
262289
dark,
@@ -266,5 +293,6 @@ export const preset: Record<string, Theme> = {
266293
tokyoNight,
267294
nord,
268295
midnight,
269-
kawaiiCat
296+
kawaiiCat,
297+
retro,
270298
}

0 commit comments

Comments
 (0)