Skip to content

Instantly share code, notes, and snippets.

if ( 'AmbientLightSensor' in window ) {
const sensor = new AmbientLightSensor();
sensor.onreading = () => {
if ( sensor.illuminance < 20) {
element.style.setProperty('--bg', 'black’);
} else {
element.style.setProperty('--bg', 'blue’);
}
};
sensor.start();
.layout-main {
display: inline-block;
display: flex;
display: grid;
width: 100%;
}
.layout-main__left {
float: left;
width: 75%;
.layout-main {
display: inline-block;
display: flex;
width: 100%;
}
.layout-main__left {
float: left;
width: 75%;
}
.layout-main {
display: inline-block;
width: 100%;
}
.layout-main__left {
float: left;
width: 75%;
}
@mixin spacing-loop($property, $space, $value) {
@each $poskey, $posvalue in $spacing-key {
&-#{$poskey}-#{$space} {
@if $poskey == "all" {
#{$property}: $value;
}
@else if $poskey == "vert" {
#{$property}-top: $value;
#{$property}-bottom: $value;
}
@mixin spacing-loop($property, $space, $value) {
@each $poskey, $posvalue in $spacing-key {
&-#{$poskey}-#{$space} {
}
}
}
@mixin spacing-loop($property, $space, $value) {
@each $poskey, $posvalue in $spacing-key {
}
}
@mixin spacing-loop($property, $space, $value) {
}
@for $space from 0 through $spacing-limit {
$value: $space + rem;
.util-pad {
@include spacing-loop("padding", $space, $value);
}
.util-margin {
@include spacing-loop("margin", $space, $value);
}
}
@for $space from 0 through $spacing-limit {
$value: $space + rem;
.util-pad {
}
.util-margin {
}
}