-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (36 loc) · 1.08 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Simple libraries
export function toUrl(id) {
// return 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/' + id.padStart(3, '0') + '.png';
return 'https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/' + id + '.png'
}
export function toId(url) {
return url.split('pokemon-species')[1].replaceAll('/', '');
}
export function capitalize(name) {
name = name.split('-').map(i => i[0].toUpperCase() + i.substring(1).toLowerCase()).join(' ');
return name;
}
export const api = 'https://pokeapi.co/api/v2/';
export const typeToColor = {
bug: "#92BC2C",
dark: "#595761",
dragon: "#0C69C8",
electric: "#F2D94E",
fire: "#FBA54C",
fairy: "#EE90E6",
fighting: "#D3425F",
flying: "#A1BBEC",
ghost: "#5F6DBC",
grass: "#5FBD58",
ground: "#DA7C4D",
ice: "#75D0C1",
normal: "#A0A29F",
poison: "#B763CF",
psychic: "#FA8581",
rock: "#C9BB8A",
steel: "#5695A3",
water: "#539DDF"
}
export function dimColor(color) {
return `color-mix(in srgb, ${color} 45%, rgb(100, 100, 100))`;
}