-
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.
- Loading branch information
Showing
32 changed files
with
461 additions
and
378 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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ env: | |
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
Deploy-Production: | ||
runs-on: ubuntu-latest | ||
|
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
const path = require('path') | ||
|
||
const buildEslintCommand = (filenames) => | ||
`next lint --fix --file ${filenames | ||
.map((f) => path.relative(process.cwd(), f)) | ||
.join(' --file ')}` | ||
|
||
module.exports = { | ||
'*.{js,jsx,ts,tsx}': [buildEslintCommand], | ||
} | ||
} |
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,12 @@ | ||
{ | ||
"tailwindConfig": "./tailwind.config.ts", | ||
"plugins": ["prettier-plugin-tailwindcss"], | ||
"pluginSearchDirs": false, | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"printWidth": 80, | ||
"semi": false, | ||
"trailingComma": "es5", | ||
"jsxSingleQuote": true, | ||
"singleQuote": true | ||
} |
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 |
---|---|---|
|
@@ -12,8 +12,6 @@ | |
"chore", | ||
"revert" | ||
], | ||
"skip_ci_types": [ | ||
"docs" | ||
], | ||
"skip_ci_types": ["docs"], | ||
"version": 1 | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,43 @@ | ||
export const hexToRgb = (hex: string) => { | ||
const hexValue = hex.replace("#", ""); | ||
const hexValue = hex.replace('#', '') | ||
|
||
const r = parseInt(hexValue.substring(0, 2), 16); | ||
const g = parseInt(hexValue.substring(2, 4), 16); | ||
const b = parseInt(hexValue.substring(4, 6), 16); | ||
const r = parseInt(hexValue.substring(0, 2), 16) | ||
const g = parseInt(hexValue.substring(2, 4), 16) | ||
const b = parseInt(hexValue.substring(4, 6), 16) | ||
|
||
return { r, g, b }; | ||
}; | ||
return { r, g, b } | ||
} | ||
|
||
export const calculateLuminance = (rgb: { | ||
r: number; | ||
g: number; | ||
b: number; | ||
r: number | ||
g: number | ||
b: number | ||
}) => { | ||
const { r, g, b } = rgb; | ||
const { r, g, b } = rgb | ||
|
||
const rsrgb = r / 255; | ||
const gsrgb = g / 255; | ||
const bsrgb = b / 255; | ||
const rsrgb = r / 255 | ||
const gsrgb = g / 255 | ||
const bsrgb = b / 255 | ||
|
||
const rL = | ||
rsrgb <= 0.04045 ? rsrgb / 12.92 : ((rsrgb + 0.055) / 1.055) ** 2.4; | ||
const gL = | ||
gsrgb <= 0.04045 ? gsrgb / 12.92 : ((gsrgb + 0.055) / 1.055) ** 2.4; | ||
const bL = | ||
bsrgb <= 0.04045 ? bsrgb / 12.92 : ((bsrgb + 0.055) / 1.055) ** 2.4; | ||
const rL = rsrgb <= 0.04045 ? rsrgb / 12.92 : ((rsrgb + 0.055) / 1.055) ** 2.4 | ||
const gL = gsrgb <= 0.04045 ? gsrgb / 12.92 : ((gsrgb + 0.055) / 1.055) ** 2.4 | ||
const bL = bsrgb <= 0.04045 ? bsrgb / 12.92 : ((bsrgb + 0.055) / 1.055) ** 2.4 | ||
|
||
const luminance = 0.2126 * rL + 0.7152 * gL + 0.0722 * bL; | ||
const luminance = 0.2126 * rL + 0.7152 * gL + 0.0722 * bL | ||
|
||
return luminance; | ||
}; | ||
return luminance | ||
} | ||
|
||
export const calculateRGBsContrast = (text: string, background: string) => { | ||
const rgbText = hexToRgb(text); | ||
const rgbBackground = hexToRgb(background); | ||
const rgbText = hexToRgb(text) | ||
const rgbBackground = hexToRgb(background) | ||
|
||
const luminanceText = calculateLuminance(rgbText); | ||
const luminanceBackground = calculateLuminance(rgbBackground); | ||
const luminanceText = calculateLuminance(rgbText) | ||
const luminanceBackground = calculateLuminance(rgbBackground) | ||
|
||
const contrast = | ||
(Math.max(luminanceText, luminanceBackground) + 0.05) / | ||
(Math.min(luminanceText, luminanceBackground) + 0.05); | ||
(Math.min(luminanceText, luminanceBackground) + 0.05) | ||
|
||
return +contrast.toFixed(2); | ||
}; | ||
return +contrast.toFixed(2) | ||
} |
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 |
---|---|---|
@@ -1,36 +1,31 @@ | ||
import "../styles/globals.css"; | ||
import type { Metadata } from "next"; | ||
import { Inter } from "next/font/google"; | ||
import '../styles/globals.css' | ||
import type { Metadata } from 'next' | ||
import { Inter } from 'next/font/google' | ||
|
||
import DarkModeProvider from "@/components/theme/DarkModeProvider"; | ||
import Navbar from "@/components/navbar/Navbar"; | ||
import Footer from "@/components/footer/Footer"; | ||
import DarkModeProvider from '@/components/theme/DarkModeProvider' | ||
import Navbar from '@/components/navbar/Navbar' | ||
import Footer from '@/components/footer/Footer' | ||
|
||
const inter = Inter({ subsets: ["latin"] }); | ||
const inter = Inter({ subsets: ['latin'] }) | ||
|
||
export const metadata: Metadata = { | ||
title: "Swift Contrast", | ||
title: 'Swift Contrast', | ||
description: | ||
"A lightweight color picker with real-time WCAG contrast analysis for accessible and inclusive design decisions.", | ||
}; | ||
'A lightweight color picker with real-time WCAG contrast analysis for accessible and inclusive design decisions.', | ||
} | ||
|
||
const RootLayout = ({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) => | ||
( | ||
<html className="dark" lang="en" style={{ colorScheme: "dark" }}> | ||
const RootLayout = ({ children }: { children: React.ReactNode }) => ( | ||
<html className='dark' lang='en' style={{ colorScheme: 'dark' }}> | ||
<body className={inter.className}> | ||
<DarkModeProvider> | ||
<Navbar /> | ||
<main id="main" className="p-2"> | ||
<main id='main' className='p-2'> | ||
{children} | ||
</main> | ||
<Footer /> | ||
</DarkModeProvider> | ||
</body> | ||
</html> | ||
); | ||
) | ||
|
||
export default RootLayout; | ||
export default RootLayout |
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import ColorContrast from "@/components/contrast/ColorContrast"; | ||
import ContrastCheckerGuide from "@/components/guides/ContrastCheckerGuide"; | ||
import ColorContrast from '@/components/contrast/ColorContrast' | ||
import ContrastCheckerGuide from '@/components/guides/ContrastCheckerGuide' | ||
|
||
const Home = () => ( | ||
<section id="home"> | ||
<section id='home'> | ||
<title>Swift Contrast - WCAG Contrast Checker</title> | ||
<h1 className="block whitespace-nowrap text-xl lg:text-3xl font-semibold text-center"> | ||
<h1 className='block whitespace-nowrap text-center text-xl font-semibold lg:text-3xl'> | ||
Swift Contrast | ||
</h1> | ||
|
||
<ColorContrast /> | ||
<ColorContrast /> | ||
|
||
<ContrastCheckerGuide /> | ||
</section> | ||
); | ||
) | ||
|
||
export default Home; | ||
export default Home |
Oops, something went wrong.