add tahoe pic and mildly refactor processcolors
This commit is contained in:
parent
87cb5d6525
commit
d3c8790482
BIN
data/gallery/_DSC9811.jpg
(Stored with Git LFS)
Normal file
BIN
data/gallery/_DSC9811.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -8,6 +8,7 @@ import * as R from "ramda";
|
|||||||
import exifr from "exifr";
|
import exifr from "exifr";
|
||||||
import sharp from "sharp";
|
import sharp from "sharp";
|
||||||
import { Palette } from "node-vibrant/lib/color";
|
import { Palette } from "node-vibrant/lib/color";
|
||||||
|
import { performance } from "perf_hooks";
|
||||||
|
|
||||||
// const path = require("path");
|
// const path = require("path");
|
||||||
// const Vibrant = require("node-vibrant");
|
// const Vibrant = require("node-vibrant");
|
||||||
@ -45,24 +46,20 @@ function processColors(vibrantData: Palette, imagePath: string) {
|
|||||||
badContrast(DarkVibrant, LightMuted)
|
badContrast(DarkVibrant, LightMuted)
|
||||||
) {
|
) {
|
||||||
DarkVibrant = DarkVibrant.darken();
|
DarkVibrant = DarkVibrant.darken();
|
||||||
if (badContrast(DarkVibrant, Vibrant)) {
|
|
||||||
Vibrant = Vibrant.brighten();
|
|
||||||
}
|
|
||||||
if (badContrast(DarkVibrant, Vibrant)) {
|
|
||||||
Vibrant = Vibrant.brighten();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (badContrast(DarkVibrant, Vibrant)) {
|
||||||
|
Vibrant = Vibrant.brighten();
|
||||||
|
}
|
||||||
|
if (badContrast(DarkVibrant, Vibrant)) {
|
||||||
|
Vibrant = Vibrant.brighten();
|
||||||
|
}
|
||||||
|
|
||||||
// second pass - first doesn't always do enough
|
// second pass - first doesn't always do enough
|
||||||
if (
|
if (badContrast(DarkVibrant, Vibrant)) {
|
||||||
badContrast(DarkVibrant, Vibrant) ||
|
Vibrant = Vibrant.brighten(2);
|
||||||
badContrast(DarkVibrant, LightMuted)
|
}
|
||||||
) {
|
if (badContrast(DarkVibrant, LightMuted)) {
|
||||||
if (badContrast(DarkVibrant, Vibrant)) {
|
LightMuted = LightMuted.brighten(2);
|
||||||
Vibrant = Vibrant.brighten(2);
|
|
||||||
}
|
|
||||||
if (badContrast(DarkVibrant, LightMuted)) {
|
|
||||||
LightMuted = LightMuted.brighten(2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// only used for hover styles, so we should give it a shot but it's not a huge deal if it's not very legible
|
// only used for hover styles, so we should give it a shot but it's not a huge deal if it's not very legible
|
||||||
@ -177,7 +174,7 @@ export const onCreateNode: GatsbyNode["onCreateNode"] = async function ({
|
|||||||
.toBuffer();
|
.toBuffer();
|
||||||
|
|
||||||
const vibrantData = await Vibrant.from(resizedImage)
|
const vibrantData = await Vibrant.from(resizedImage)
|
||||||
.quality(1)
|
// .quality(1)
|
||||||
.getPalette();
|
.getPalette();
|
||||||
|
|
||||||
createNodeField({
|
createNodeField({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user