var DemoApp = angular.module('DemoApp', ['dx']);
DemoApp.controller('DemoController', function DemoController($scope) {
$scope.currentColor = "#f05b41";
$scope.colorBox = {
simple: {
value: "#f05b41"
},
editAlphaChannel: {
value: "#f05b41",
editAlphaChannel: true
},
editButtonText: {
value: "#f05b41",
applyButtonText: "Apply",
cancelButtonText: "Decline"
},
readOnly: {
value: "#f05b41",
readOnly: true
},
disabled: {
value: "#f05b41",
disabled: true
},
withChangeValue: {
applyValueMode: "instantly",
bindingOptions: {
value: "currentColor"
}
}
};
});
<!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="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script>
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/20.2.4/css/dx.common.css" />
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/20.2.4/css/dx.light.css" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script>
<script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C/script%3E'))</script>
<script src="https://cdn3.devexpress.com/jslib/20.2.4/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" ng-app="DemoApp" ng-controller="DemoController">
<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 dx-color-box="colorBox.simple"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">With alpha channel editing</div>
<div class="dx-field-value">
<div dx-color-box="colorBox.editAlphaChannel"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Custom button captions</div>
<div class="dx-field-value">
<div dx-color-box="colorBox.editButtonText"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Read only</div>
<div class="dx-field-value">
<div dx-color-box="colorBox.readOnly"></div>
</div>
</div>
<div class="dx-field">
<div class="dx-field-label">Disabled</div>
<div class="dx-field-value">
<div dx-color-box="colorBox.disabled"></div>
</div>
</div>
</div>
<div class="dx-fieldset">
<div class="dx-fieldset-header">Event Handling</div>
<div class="hero-block">
<div class="color-block" ng-style="{'background-color': currentColor}">
<div class="superhero"></div>
</div>
<div class="hero-color-box">
<div dx-color-box="colorBox.withChangeValue"></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-darkmoon .superhero {
background-image: url(../../../../images/hero_darkmoon.png);
}
.dx-color-scheme-darkviolet .superhero {
background-image: url(../../../../images/hero_darkviolet.png);
}
.dx-color-scheme-greenmist .superhero {
background-image: url(../../../../images/hero_greenmist.png);
}
.dx-color-scheme-contrast .superhero {
background-image: url(../../../../images/hero_contrast.png);
}
.dx-color-scheme-blue-dark .superhero,
.dx-color-scheme-orange-dark .superhero,
.dx-color-scheme-teal-dark .superhero,
.dx-color-scheme-lime-dark .superhero,
.dx-color-scheme-purple-dark .superhero {
background-image: url(../../../../images/hero_material_dark.png);
}