Skip to content

Instantly share code, notes, and snippets.

@colorswall
colorswall / gist:ea2dced5ae0af5804d5d869d77ce59db
Last active September 20, 2018 09:36
HEX to RGB JavaScript convert
const hex2rgb = (hex, alpha) => {
const r = parseInt(hex.slice(1, 3), 16);
const g = parseInt(hex.slice(3, 5), 16);
const b = parseInt(hex.slice(5, 7), 16);
return { r, g, b };
};
@colorswall
colorswall / gist:6a42cab412349e965e07a751b0852c41
Created September 20, 2018 09:35
RGB to HEX JavaScript convert
const rgb2hex = (r, g, b) => {
var rgb = b | (g << 8) | (r << 16);
return '#' + (0x1000000 + rgb).toString(16).slice(1)
}
@colorswall
colorswall / Stylefile.yml
Created July 30, 2018 12:59
Customizations for colorswall.com via StyleURL.
---
version: 1.0
domains:
- colorswall.com
url_patterns:
- colorswall.com/*
timestamp: '2018-07-30T12:59:22Z'
id: w74A
redirect_url: https://colorswall.com/
shared_via: StyleURL - (https://styleurl.app) import and export CSS changes from Chrome
@colorswall
colorswall / Nuxt.js html remove cache meta
Created June 4, 2018 10:05
Force remove cache html tag meta nuxt.config.js
head: {
title: 'ColorsWall.com',
meta: [
{ hid: 'http-equiv-cache-control', 'http-equiv': 'Cache-Control', content: 'no-cache, no-store, must-revalidate' },
{ hid: 'http-equiv-pragma', 'http-equiv': 'Pragma', content: 'no-cache' },
{ hid: 'http-equiv-expires', 'http-equiv': 'Expires', content: '0' },
]
}
@colorswall
colorswall / nuxt.config.js
Last active May 17, 2018 14:45
nuxt.config.js add script in header
head: {
__dangerouslyDisableSanitizers: ['script'],
script: [{
innerHTML: `
console.log('Hello Script')
`,
type: 'application/ld+json',
body: true
}],
},
const getRandomArbitrary = (min, max) => parseInt(Math.random() * (max - min) + min, 10)
const generateRandomRGBColor = () =>
`rgb(${getRandomArbitrary(0, 255)}, ${getRandomArbitrary(0, 255)}, ${getRandomArbitrary(0, 255)})`;
// generateRandomRGBColor()
// Result rgb(101, 216, 215)
https://colorswall.com //Place to store color palettes