From ee0feeb527f50fb694b688b5e68c64425de8049b Mon Sep 17 00:00:00 2001 From: Jake Dexheimer Date: Tue, 3 Oct 2017 03:22:04 -0700 Subject: [PATCH] Twitter colorpicker -> Sketch colorpicker --- components/Carbon.js | 2 +- components/ColorPicker.js | 36 ++++++++++++++++++------------------ lib/util.js | 2 ++ pages/editor.js | 2 +- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/components/Carbon.js b/components/Carbon.js index 3e057f2..f2da23c 100644 --- a/components/Carbon.js +++ b/components/Carbon.js @@ -16,7 +16,7 @@ const DEFAULT_SETTINGS = { paddingHorizontal: '50px', marginVertical: '45px', marginHorizontal: '45px', - background: '#fed0ec', + background: 'rgba(171, 184, 195, 1)', theme: 'seti', language: DEFAULT_LANGUAGE } diff --git a/components/ColorPicker.js b/components/ColorPicker.js index 754aac7..b3ad148 100644 --- a/components/ColorPicker.js +++ b/components/ColorPicker.js @@ -1,8 +1,9 @@ import React from 'react' import enhanceWithClickOutside from 'react-click-outside' -import { TwitterPicker } from 'react-color' +import { SketchPicker } from 'react-color' import WindowPointer from './WindowPointer' import { COLORS } from '../lib/constants' +import { parseRGBA } from '../lib/util' class ColorPicker extends React.Component { constructor() { @@ -21,7 +22,7 @@ class ColorPicker extends React.Component { } handlePickColor(color) { - this.props.onChange(color.hex) + this.props.onChange(parseRGBA(color.rgb)) } render() { @@ -35,11 +36,7 @@ class ColorPicker extends React.Component { diff --git a/lib/util.js b/lib/util.js index 9f56745..ffa9944 100644 --- a/lib/util.js +++ b/lib/util.js @@ -9,5 +9,7 @@ const parse = v => { } catch (e) {} } +export const parseRGBA = obj => `rgba(${obj.r},${obj.g},${obj.b},${obj.a})` + export const getState = morph.compose(parse, morph.get(KEY)) export const saveState = (window, v) => assign(window, JSON.stringify(v)) diff --git a/pages/editor.js b/pages/editor.js index fe452b9..b3c328f 100644 --- a/pages/editor.js +++ b/pages/editor.js @@ -43,7 +43,7 @@ class Editor extends React.Component { constructor(props) { super(props) this.state = { - background: '#ABB8C3', + background: 'rgba(171, 184, 195, 1)', theme: THEMES.seti.id, language: DEFAULT_LANGUAGE, dropShadow: true,