From 32d1683e513bb09c35303277ac84504c27435481 Mon Sep 17 00:00:00 2001 From: Jake Jarvis Date: Sun, 9 Jan 2022 19:49:54 -0500 Subject: [PATCH] revert colord to smaller hex-rgb --- package.json | 2 +- pages/index.tsx | 7 +++---- yarn.lock | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 51090ea1..31d6d253 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pages/index.tsx b/pages/index.tsx index 6e4237a0..ec30f4a4 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -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 ( diff --git a/yarn.lock b/yarn.lock index 0c307861..b06bd06b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"