Your search did not match any results.
Color Box

Overview

Documentation
The ColorBox is a widget that allows an end user to enter a color or pick it out from the drop-down editor.
Copy to Codepen
Apply
Reset
window.onload = function() { var currentColor = ko.observable("#f05b41"); var viewModel = { currentColor: currentColor, colorBoxSimple: { value: "#f05b41" }, colorBoxDisabled: { value: "#f05b41", disabled: true }, colorBoxReadOnly: { value: "#f05b41", readOnly: true }, colorBoxEditButtonText: { value: "#f05b41", applyButtonText: "Apply", cancelButtonText: "Decline" }, colorBoxEditAlphaChannel: { value: "#f05b41", editAlphaChannel: true }, colorBoxWithChangeValue: { value: currentColor, applyValueMode: "instantly" } }; ko.applyBindings(viewModel, document.getElementById("color-box-demo")); };
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="js/jquery-3.1.0.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/16.2.6/css/dx.light.css" /> <script src="https://cdn3.devexpress.com/jslib/16.2.6/js/dx.all.js"></script> <link rel="stylesheet" type ="text/css" href ="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="color-box-demo"> <div class="form"> <div class="dx-fieldset"> <div class="dx-field"> <div class="dx-field-label">Default mode</div> <div class="dx-field-value"> <div data-bind="dxColorBox: colorBoxSimple"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Disabled</div> <div class="dx-field-value"> <div data-bind="dxColorBox: colorBoxDisabled"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Read only</div> <div class="dx-field-value"> <div data-bind="dxColorBox: colorBoxReadOnly"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">Custom button captions</div> <div class="dx-field-value"> <div data-bind="dxColorBox: colorBoxEditButtonText"></div> </div> </div> <div class="dx-field"> <div class="dx-field-label">With alpha channel editing</div> <div class="dx-field-value"> <div data-bind="dxColorBox: colorBoxEditAlphaChannel"></div> </div> </div> </div> <div class="dx-fieldset"> <div class="dx-fieldset-header">Event Handling</div> <div class="hero-block"> <div class="color-block" data-bind="style: { backgroundColor: currentColor}"> <div class="superhero"></div> </div> <div class="hero-color-box"> <div data-bind="dxColorBox: colorBoxWithChangeValue"></div> </div> </div> </div> </div> </div> </div> </body> </html>
.form { min-height: 690px; } .form .dx-field-value { text-align: right; } .dx-fieldset-header { padding: 10px 0; } .color-block { width: 360px; height: 254px; background-color: #f05b41; position: relative; } .hero-color-box{ position: absolute; right: 0; left: 400px; top: 110px; } .color-block .superhero{ position: absolute; height: 100%; width: 100%; } .hero-block { position: relative; } .superhero { background-image: url(../../../../images/hero_white.png); } .dx-color-scheme-dark .superhero { background-image: url(../../../../images/hero_black.png); } .dx-color-scheme-contrast .superhero { background-image: url(../../../../images/hero_contrast.png); }