Skip to content

Instantly share code, notes, and snippets.

View colorful-tones's full-sized avatar
💓
Don’t believe the hype!

Damon Cook colorful-tones

💓
Don’t believe the hype!
View GitHub Profile
@colorful-tones
colorful-tones / Gutenberg Style Guide
Last active November 28, 2023 11:02
A simple style guide for Gutenberg FSE theme development
<!-- wp:spacer {"height":"150px"} -->
<div style="height:150px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- wp:group {"align":"wide","layout":{"inherit":false}} -->
<div class="wp-block-group alignwide"><!-- wp:columns {"verticalAlignment":"center"} -->
<div class="wp-block-columns are-vertically-aligned-center"><!-- wp:column {"verticalAlignment":"center","style":{"spacing":{"padding":{"top":"3rem","right":"1rem","bottom":"3rem","left":"1rem"}},"border":{"width":"1px"}},"backgroundColor":"contrast","className":"has-border-color has-black-border-color"} -->
<div class="wp-block-column is-vertically-aligned-center has-border-color has-black-border-color has-contrast-background-color has-background" style="border-width:1px;padding-top:3rem;padding-right:1rem;padding-bottom:3rem;padding-left:1rem"><!-- wp:paragraph {"textColor":"base","fontSize":"small"} -->
<p class="has-base-color has-text-color has-small-font-size">Contrast</p>
<!-- /wp:paragraph --></div>
@colorful-tones
colorful-tones / block.json
Last active August 11, 2021 16:36
Block template for InnerBlocks
{
"apiVersion": 2,
"name": "namespace/carousel",
"title": "Carousel",
"category": "custom-category",
"icon": "slides",
"keywords": [ "carousel", "slider" ],
"description": "Add a swipeable carousel of content.",
"supports": {
"html": false
@colorful-tones
colorful-tones / arrow-left.js
Last active July 2, 2021 17:08
SVG Icon block
import { SVG, Path } from '@wordpress/components';
const arrowLeft = (
<SVG fill="none" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">
<Path
d="m1.333 14.389 9.466-9.466c.872-.872 2.326-.872 3.198 0s.872 2.326 0 3.198l-5.589 5.621h20.677c1.26 0 2.262 1.002 2.262 2.261s-1.002 2.262-2.262 2.262h-20.677l5.589 5.589c.872.872.872 2.326 0 3.198-.452.452-1.034.678-1.615.678s-1.163-.226-1.615-.678l-9.434-9.434c-.42-.42-.678-1.002-.678-1.615s.226-1.195.678-1.615z"
fill="currentColor"
/>
</SVG>
);
@colorful-tones
colorful-tones / customizer.php
Last active March 17, 2020 04:40
Child theme for Go - includes custom Customizer options
<?php
/**
* Customizer setup
*
* @package YourChildTheme
*/
namespace YourChildTheme\Customizer;
/**
@colorful-tones
colorful-tones / gutenberg-sample-content.html
Last active February 21, 2019 00:36 — forked from mailenkno/gutenberg-sample-content.html
WordPress Gutenberg Sample Content
<!-- wp:heading {"level":1} -->
<h1>This is a heading (H1)</h1>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>This is a heading (H2)</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3>This is a heading (H3)</h3>
@colorful-tones
colorful-tones / foobar.css
Created October 31, 2018 18:24
CSS variables: valid vs invalid values
:root {
--my-var: 🎃;
}
.foo {
color: var(--my-var);
}
@colorful-tones
colorful-tones / foo.css
Created October 31, 2018 18:22
CSS variables with fallback value
.foo {
color: var(--my-var, red); /* Red if --my-var is not defined */
}
@colorful-tones
colorful-tones / variables.css
Last active November 1, 2018 13:14
CSS color variables
:root {
/* Set initial saturation and lightness values */
--sat: 50%;
--light: 50%;
/* Set amount of light & saturation to change for darker & lighter color variants */
--shader: 15%;
/* Calculate saturation values for lighter & darker color variations */
--satDarker: calc(var(--sat) + var(--shader));
@colorful-tones
colorful-tones / buttons.css
Last active October 31, 2018 18:18
CSS buttons
.button {
--button-bg: var(--button-bg-base);
background-color: var(--button-bg);
color: var(--button-c-base);
// other button default styling stuff...
&:hover {
--button-bg: var(--button-bg-base-hover);
}
}
@colorful-tones
colorful-tones / buttons.css
Created October 31, 2018 17:54
[Managing CSS color variables] A method for writing, organizing and scaling CSS color variables #CSS
.button {
--button-bg: var(--button-bg-base);
background-color: var(--button-bg);
color: var(--button-c-base);
// other button default styling stuff...
&:hover {
--button-bg: var(--button-bg-base-hover);
}