-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added light mode to GH profile buttons (#40)
* chore: Added _blank, noopener to social links * feat: Added light mode to GH profile page buttons * chore: Updated opacity and text color of invite modal of light mode * feat: Toggle light mode based on GH preferences
- Loading branch information
Showing
8 changed files
with
64 additions
and
20 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
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,15 @@ | ||
export type ColorScheme = "auto" | "light" | "dark"; | ||
|
||
export const getGHColorScheme = (cookieString: string) => { | ||
const regex = /(?<=\bcolor_mode=)[^;]+/g; | ||
const match = regex.exec(cookieString); | ||
const cookie = match && JSON.parse(decodeURIComponent(match[0])); | ||
return (cookie.color_mode as ColorScheme) || "auto"; | ||
}; | ||
|
||
export const prefersDarkMode = (colorScheme: ColorScheme): boolean => { | ||
if (colorScheme === "auto") { | ||
return window.matchMedia("(prefers-color-scheme: dark)").matches; | ||
} | ||
return colorScheme === "dark"; | ||
}; |
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