1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 10:45:23 -04:00

revert colord to smaller hex-rgb

This commit is contained in:
Jake Jarvis 2022-01-09 19:49:54 -05:00
parent 379696166b
commit 32d1683e51
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
3 changed files with 9 additions and 5 deletions

View File

@ -32,7 +32,6 @@
"@primer/octicons-react": "^16.2.0",
"@sentry/node": "^6.16.1",
"classnames": "^2.3.1",
"colord": "^2.9.2",
"copy-to-clipboard": "^3.3.1",
"date-fns": "^2.28.0",
"fathom-client": "^3.2.0",
@ -40,6 +39,7 @@
"feed": "^4.2.2",
"formik": "^2.2.9",
"gray-matter": "^4.0.3",
"hex-rgb": "^5.0.0",
"html-escaper": "^3.0.3",
"is-absolute-url": "^4.0.1",
"is-email-like": "^2.0.0",

View File

@ -1,6 +1,6 @@
import Link from "next/link";
import isAbsoluteUrl from "is-absolute-url";
import { colord } from "colord";
import hexRgb from "hex-rgb";
import { WaveIcon, LockIcon } from "../components/icons";
type ColorLinkProps = {
@ -15,9 +15,8 @@ type ColorLinkProps = {
const ColorLink = ({ href, title, lightColor, darkColor, external = false, children }: ColorLinkProps) => {
external = external || isAbsoluteUrl(href);
// spits out an alpha color in rgba() that's compatible with linear-gradient()
const underlineAlpha = 0.4;
const hexToRgba = (hex: string) => colord(hex).alpha(underlineAlpha).toRgbString();
// spits out a translucent color in rgba() format that's compatible with linear-gradient()
const hexToRgba = (hex: string, alpha: number = 0.4) => hexRgb(hex, { alpha, format: "css" });
return (
<Link href={href} passHref={true} prefetch={false}>

View File

@ -3464,6 +3464,11 @@ hast-util-whitespace@^2.0.0:
resolved "https://registry.yarnpkg.com/hast-util-whitespace/-/hast-util-whitespace-2.0.0.tgz#4fc1086467cc1ef5ba20673cb6b03cec3a970f1c"
integrity sha512-Pkw+xBHuV6xFeJprJe2BBEoDV+AvQySaz3pPDRUs5PNZEMQjpXJJueqrpcHIXxnWTcAGi/UOCgVShlkY6kLoqg==
hex-rgb@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/hex-rgb/-/hex-rgb-5.0.0.tgz#e2c9eb6a37498d66c5a350a221ed4c2c7d1a92d6"
integrity sha512-NQO+lgVUCtHxZ792FodgW0zflK+ozS9X9dwGp9XvvmPlH7pyxd588cn24TD3rmPm/N0AIRXF10Otah8yKqGw4w==
highlight.js@~11.4.0:
version "11.4.0"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-11.4.0.tgz#34ceadd49e1596ee5aba3d99346cdfd4845ee05a"