Skip to content

Instantly share code, notes, and snippets.

View dennishn's full-sized avatar

Dennis Haulund Nielsen dennishn

View GitHub Profile

Color Conversion Formulas RGB to XY and back

This document describes the conversion between RGB and xy. It is important to differentiate between the various light types, because they do not all support the same color gamut. For example, the hue bulbs are very good at showing nice whites, while the LivingColors are generally a bit better at colors, like green and cyan. For more info, check out the supported lights page.

Gamut

The colors of Hue lights are controlled by xy values in the CIE color space. Since this is a well defined color space that is independent of the gamut of any specific light, we know for sure that the same xy value always result in the same color, regardless of the type of light used (as long as the color is within the gamut of the light).
Current Philips Hue lights have a color gamut defined by 3 points, making it a tri

@dennishn
dennishn / docs.md
Created December 23, 2024 10:58
Nanoleaf Docs

 

1. Introduction

This documentation provides the detailed interfaces and structure of the Nanoleaf Devices OpenAPI, an interface developed for third-party developers to authenticate, control, and obtain information of the Panels, via a simple RESTful API over HTTP.

2. Definitions

@dennishn
dennishn / 01-theme.json
Last active July 18, 2023 13:14
Chakra UI default theme
{
"radii": {
"none": "0",
"sm": "0.125rem",
"base": "0.25rem",
"md": "0.375rem",
"lg": "0.5rem",
"xl": "0.75rem",
"2xl": "1rem",
"3xl": "1.5rem",
import * as React from "React";
import { forwardRef, chakra, HTMLChakraProps, shouldForwardProp } from "@chakra-ui/react";
export type StateLayerState = "none" | "hover" | "pressed" | "dragged" | "focus";
interface StateLayerOptions {
forceState?: StateLayerState;
focusWithin?: boolean;
}
{
"plugins": [
"/Users/dni/WebstormProjects/@akqa-frontline/frontline/packages/stylelint-config-frontline/node_modules/stylelint-prettier/stylelint-prettier.js",
"/Users/dni/WebstormProjects/@akqa-frontline/frontline/packages/stylelint-config-frontline/node_modules/stylelint-scss/dist/index.js"
],
"rules": {
"prettier/prettier": [
true
],
"indentation": null,
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"jest": true,
"node": true
},
"globals": {},
"parser": "/Users/dni/WebstormProjects/@akqa-frontline/frontline/packages/eslint-config-frontline/node_modules/babel-eslint/lib/index.js",
"devDependencies": {
"cross-env": "^6.0.3",
"node-sass": "^4.13.1",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.9.0"
},
"dependencies": {
"@babel/runtime": "^7.7.2",
"@babel/runtime-corejs3": "^7.7.2",
@dennishn
dennishn / 01-hasAxiosClient.js
Last active November 15, 2018 12:45
Axios HOC with Cache and configurable delay
import React, {Component} from 'react';
import axios from 'axios';
import hash from 'object-hash';
const hasAxiosClient = (baseURL, delay = 0) => WrappedComponent => {
class HasAxiosClient extends Component {
// Consumers can track the state of any request done in the hasAxiosClient HOC
// Nice for "global" loaders - alternatively all requests returns a promise so you can handle
// it individually. Think of this loading state property as an <ErrorBoundary>.
@dennishn
dennishn / mat-variables.scss
Created July 23, 2018 14:35
mat-variables.scss
$mat-autocomplete-panel-max-height: 256px !default;
$mat-badge-font-size: 12px;
$mat-badge-font-weight: 600;
$mat-badge-default-size: 22px !default;
$mat-badge-small-size: $mat-badge-default-size - 6;
$mat-badge-large-size: $mat-badge-default-size + 6;
$_mat-bottom-sheet-width-increment: 64px;
$mat-bottom-sheet-container-vertical-padding: 8px !default;
$mat-bottom-sheet-container-horizontal-padding: 16px !default;
$mat-button-toggle-padding: 0 16px !default;

There is quite a difference between old and new spacing rules. I fear that we will have some very inconsistent layout if we mix these values.

An option could be to ask the designer to map the old values to the new ones.

$newSizes: (
  5: 5px
);

$s1: map_get($newSizes, 5);