-
-
Notifications
You must be signed in to change notification settings - Fork 772
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
160 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
language.ts |
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
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,36 @@ | ||
export const LanguageToColorMap = { | ||
typescript: '#2b7489', | ||
javascript: '#f1e05a', | ||
html: '#e34c26', | ||
java: '#b07219', | ||
go: '#00add8', | ||
vue: '#2c3e50', | ||
css: '#563d7c', | ||
yaml: '#cb171e', | ||
json: '#292929', | ||
markdown: '#083fa1', | ||
csharp: '#178600', | ||
'c#': '#178600', | ||
c: '#555555', | ||
cpp: '#f34b7d', | ||
'c++': '#f34b7d', | ||
python: '#3572a5', | ||
lua: '#000080', | ||
vimscript: '#199f4b', | ||
shell: '#89e051', | ||
dockerfile: '#384d54', | ||
ruby: '#701516', | ||
php: '#4f5d95', | ||
lisp: '#3fb68b', | ||
kotlin: '#F18E33', | ||
rust: '#dea584', | ||
dart: '#00B4AB', | ||
swift: '#ffac45', | ||
'objective-c': '#438eff', | ||
'objective-c++': '#6866fb', | ||
r: '#198ce7', | ||
matlab: '#e16737', | ||
scala: '#c22d40', | ||
sql: '#e38c00', | ||
perl: '#0298c3', | ||
} |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
export const calculateDimensions = ({ | ||
width, | ||
height, | ||
max, | ||
}: { | ||
width: number | ||
height: number | ||
max: { width: number; height: number } | ||
}) => { | ||
if (width === 0 || height === 0) throw new Error('Invalid image size') | ||
|
||
const { width: maxW, height: maxH } = max | ||
|
||
const wRatio = maxW / width || 1 | ||
const hRatio = maxH / height || 1 | ||
|
||
const ratio = Math.min(wRatio, hRatio, 1) | ||
|
||
return { | ||
width: width * ratio, | ||
height: height * ratio, | ||
} | ||
} | ||
|
||
export function getDominantColor(imageObject: HTMLImageElement) { | ||
const canvas = document.createElement('canvas'), | ||
ctx = canvas.getContext('2d')! | ||
|
||
canvas.width = 1 | ||
canvas.height = 1 | ||
|
||
// draw the image to one pixel and let the browser find the dominant color | ||
ctx.drawImage(imageObject, 0, 0, 1, 1) | ||
|
||
// get pixel color | ||
const i = ctx.getImageData(0, 0, 1, 1).data | ||
|
||
return `#${((1 << 24) + (i[0] << 16) + (i[1] << 8) + i[2]) | ||
.toString(16) | ||
.slice(1)}` | ||
} |
fefdbee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
shiro – ./
springtide.vercel.app
shiro-innei.vercel.app
shiro-git-main-innei.vercel.app
innei.in