|
| 1 | +export function useFrameworks() { |
| 2 | + // Colors are used in the comparator charts |
| 3 | + const frameworks = ref([ |
| 4 | + { name: 'nuxt', package: 'nuxt', color: 'oklch(0.7862 0.192 155.63)' }, |
| 5 | + { name: 'vue', package: 'vue', color: 'oklch(0.7025 0.132 160.37)' }, |
| 6 | + { name: 'nitro', package: 'nitro', color: 'oklch(70.4% 0.191 22.216)' }, |
| 7 | + { name: 'react', package: 'react', color: 'oklch(0.832 0.1167 218.69)' }, |
| 8 | + { name: 'svelte', package: 'svelte', color: 'oklch(0.6917 0.1865 35.04)' }, |
| 9 | + { name: 'vite', package: 'vite', color: 'oklch(0.7484 0.1439 294.03)' }, |
| 10 | + { name: 'next', package: 'next', color: 'oklch(71.7% .1648 250.794)' }, |
| 11 | + { name: 'astro', package: 'astro', color: 'oklch(0.5295 0.2434 270.23)' }, |
| 12 | + { name: 'typescript', package: 'typescript', color: 'oklch(0.5671 0.1399 253.3)' }, |
| 13 | + { name: 'angular', package: '@angular/core', color: 'oklch(0.626 0.2663 310.4)' }, |
| 14 | + ]) |
| 15 | + |
| 16 | + type FrameworkName = (typeof frameworks.value)[number]['name'] |
| 17 | + |
| 18 | + function getFrameworkColor(framework: FrameworkName): string { |
| 19 | + return frameworks.value.find(f => f.name === framework)!.color |
| 20 | + } |
| 21 | + |
| 22 | + function isListedFramework(name: string): name is FrameworkName { |
| 23 | + return frameworks.value.some(f => f.name === name) |
| 24 | + } |
| 25 | + |
| 26 | + return { |
| 27 | + frameworks, |
| 28 | + getFrameworkColor, |
| 29 | + isListedFramework, |
| 30 | + } |
| 31 | +} |
0 commit comments