Color Wheel

Developer
Size
3,070 Kb
Views
38,456

How do I make an color wheel?

What is a color wheel? How do you make a color wheel? This script and codes were developed by Thepheer on 13 September 2022, Tuesday.

Color Wheel Previews

Color Wheel - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Color Wheel</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <template id='ColorWheel'> <div class='color-wheel'> <div> <router-link v-for='(_, name) in modes' :to='name' replace>{{ name }}</router-link> <slider v-for='(cfg, name) in sliders' :cfg='cfg'>{{ name | capitalize }}</slider> </div> <color v-for='i in items' :mode='mode' :h='360/items*i' :s='sliders.saturation.value' :l='sliders.lightness.value'></color> </div>
</template>
<template id='ColorWheel-Slider'> <div class='control'> <div class='hl'> <span class='right'>{{ cfg.value }}</span> <slot></slot> </div> <input type='range' v-model.number='cfg.value' :min='cfg.min' :max='cfg.max' :step='cfg.step' /> </div>
</template>
<template id='ColorWheel-Color'> <div class='color' :style='style'>{{ color | uppercase }}</div>
</template>
<template id='App'> <router-view></router-view>
</template> <script src='http://unpkg.com/vue'></script>
<script src='http://unpkg.com/vue-router'></script>
<script src='http://unpkg.com/hsluv'></script>
<script src='http://unpkg.com/onecolor/one-color.js'></script> <script src="js/index.js"></script>
</body>
</html>

Color Wheel - Script Codes CSS Codes

@import url('https://fonts.googleapis.com/css?family=Inconsolata');
@media (min-height: 0px) { html { font-size: 8px; } }
@media (min-height: 360px) { html { font-size: 10px; } }
@media (min-height: 432px) { html { font-size: 12px; } }
@media (min-height: 504px) { html { font-size: 14px; } }
@media (min-height: 576px) { html { font-size: 16px; } }
@media (min-height: 648px) { html { font-size: 18px; } }
@media (min-height: 720px) { html { font-size: 20px; } }
@media (min-height: 792px) { html { font-size: 22px; } }
@media (min-height: 864px) { html { font-size: 24px; } }
html { overflow: hidden; background: #2e3136; color: #717782;
}
.hl { color: #b0b9c9;
}
a { display: block; color: inherit;
}
a:not(:hover) { text-decoration: none;
}
/*input[type=range] { -webkit-appearance: none; background: #717782; height: .125em; outline: none;
}
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; background: #b0b9c9; width: .125em; height: 1em;
}*/
.color-wheel { position: absolute; top: 50%; left: 50%; font: 1em/1.15em 'Inconsolata', monospace;
}
.color-wheel > * { position: absolute; transform: translate(-50%, -50%);
}
.color-wheel .right { float: right;
}
.color-wheel .control:nth-child(1n+2) { margin-top: 1em;
}
.color-wheel .control label { display: block;
}
.color-wheel .control input { vertical-align: middle; margin: 0;
}
.color-wheel .control input[type=range] { font: inherit; width: 10em;
}
.color-wheel .color { position: absolute; /*padding: 0 .75em; border-radius: 2em; line-height: 2em; box-shadow: 0 0 .1em #1e2124; background: #36393e;*/
}

Color Wheel - Script Codes JS Codes

const modes = { HSL: ({h, s, l}) => one.color(`hsl(${h},${s}%,${l}%)`).hex(), HSLuv: ({h, s, l}) => hsluv.hsluvToHex([h, s, l]), HPLuv: ({h, s, l}) => hsluv.hpluvToHex([h, s, l])
};
const ColorWheel = Vue.extend({ template: '#ColorWheel', props: ['mode'], data: () => ({ modes, selectors: { mode: { value: 'HPLuv', list: modes } }, sliders: { saturation: { min: 0, max: 100, step: 1, value: 100 }, lightness: { min: 0, max: 100, step: 1, value: 75 }, density: { min: 1, max: 5, step: 1, value: 3 } } }), computed: { items: x => 3 * Math.pow(2, x.sliders.density.value) }, filters: { capitalize: x => x.charAt(0).toUpperCase() + x.slice(1) }, components: { color: { template: '#ColorWheel-Color', props: ['mode', 'h', 's', 'l'], computed: { color: x => modes[x.mode](x), style: x => ({ color: x.color, transform: `translate(-50%, -50%) rotate(${x.h}deg) translate(13em)` }) }, filters: { uppercase: x => x.toUpperCase() } }, slider: { template: '#ColorWheel-Slider', props: ['cfg'] } }
});
const router = new VueRouter({ linkActiveClass: 'hl', routes: [ { path: '/:mode', component: ColorWheel, props: true }, { path: '*', redirect: 'HSL' } ]
});
const app = new Vue({ template: '#App', router
});
document.body.appendChild(app.$mount().$el);
Color Wheel - Script Codes
Color Wheel - Script Codes
Home Page Home
Developer Thepheer
Username thepheer
Uploaded September 13, 2022
Rating 4
Size 3,070 Kb
Views 38,456
Do you need developer help for Color Wheel?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Thepheer (thepheer) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!