Skip to content

Commit

Permalink
Modified siteMetaData. Added headerNavLinks
Browse files Browse the repository at this point in the history
  • Loading branch information
prjctimg committed Oct 15, 2023
1 parent 44d6dba commit 9fd9d08
Show file tree
Hide file tree
Showing 40 changed files with 1,615 additions and 1,762 deletions.
3 changes: 0 additions & 3 deletions .github/FUNDING.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and Deploy
on:
push:
branches:
- api
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
persist-credentials: false

- name: Build
run: |
npm ci
npm run build
- name: Deploy
uses: JamesIves/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
BRANCH: gh-pages
FOLDER: out
CLEAN: true
12 changes: 12 additions & 0 deletions data/authors/default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Dean Tarisai
avatar: /static/images/slowly-avatar.png
occupation: Web Developer
company: Freelancer
email: [email protected]
github: https://github.com/prjctimg


---

Self taught programmer from Zimbabwe. Currently exploring the worlds of color,generative art and game development. Always learning.
16 changes: 0 additions & 16 deletions data/authors/default.mdx

This file was deleted.

12 changes: 0 additions & 12 deletions data/authors/sparrowhawk.mdx

This file was deleted.

81 changes: 81 additions & 0 deletions data/blog/achromatic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
title: Working with achromatic colors.
date: '2023-09-28'
draft: false
summary: Utility for working with grays or achromatic colors and how to differentiate them from chromatic colors programmatically.
layout: PostSimple
canonicalUrl: https://prjctimg.github.io/huetiful/api/achromatic
---

These are a subtype of colors that have no _hue_. Also known as grays, these colors can be found by interpolating black and white.

We can use the _isAchromatic_ utility to check if a color is achromatic or not.

**Parameters:**
`(color:Color):boolean`
color The color to test if it is achromatic or not.

**Returns:**
Returns true if the color is achromatic else false

**Description:**
Checks if a color is achromatic(without hue or simply grayscale).

```javascript
import { isAchromatic } from "huetiful-js";
import { formatHex8, interpolate, samples } from "culori"


isAchromatic('pink')
// false

let sample = [
"#00ffdc",
"#00ff78",
"#00c000",
"#007e00",
"#164100",
"#ffff00",
"#310000",
"#3e0000",
"#4e0000",
"#600000",
"#720000",
];

console.log(map(sample, isAchromatic));

// [
false, false, false,
false, false, false,
false, false, false,
false, false
]

isAchromatic('gray')
// Returns true


console.log(map(sample, isAchromatic));


// we create an interpolation using black and white
let f = interpolate(["black", "white"]);

//We then create 12 evenly spaced samples and pass them to f as the `t` param required by an interpolating function.
// Lastly we convert the color to hex for brevity for this example (otherwise color objects work fine too.)
let grays = map(samples(12), (c) => formatHex8(f(c)));
console.log(map(grays, isAchromatic));

//
[ false, true, true,
true, true, true,
true, true, true,
true, true, false
]

```

In the above code, we used _isAchromatic_ against different samples of achromatic as well as chromatic colors. The _samples_ array contained chromatic colors whilst `grays` holds the achromatic colors. Notice that at the last and first index when we tested for achromatic colors we had `false` values instead of _true_. This is because pure white/black are not achromatic.

> For a color to be classified as being achromatic, it needs a falsy value on the **saturation** / **chroma** channel such as 0, **NaN** or **undefined**. This is because the `hue` depends on the **saturation** channel to be true or not be gray. This means that altering the **hue** or **lightness** channel whilst **saturation** is falsy will only return a gray color and black or white (at the extreme ends of the **lightness** channel) .
Loading

0 comments on commit 9fd9d08

Please sign in to comment.