Skip to content

Commit e2c250b

Browse files
Merge pull request #2359 from danielstorey/issue/2358
Resolves #2358 - allow rgba values to be set via ColourPicker input
2 parents ac9f23c + 74a40e6 commit e2c250b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

frontend/src/modules/editor/themeEditor/views/editorThemingView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ define(function(require) {
212212
}
213213
if (fieldView.schema.inputType === 'ColourPicker') {
214214
fieldView.setValue(value);
215-
} else if (fieldView.schema.inputType.indexOf('Asset:') > -1) {
215+
} else if (typeof fieldView.schema.inputType === 'string' && fieldView.schema.inputType.indexOf('Asset:') > -1) {
216216
fieldView.setValue(value);
217217
fieldView.render();
218218
$('div[data-editor-id*="' + key + '"]').append(fieldView.editor.$el);

frontend/src/modules/scaffold/views/scaffoldColourPickerView.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ define([
2424
postRender: function() {
2525
this.$el.spectrum({
2626
color: this.value,
27-
showInput: true,
2827
showAlpha: true,
2928
showInitial: true,
3029
showInput: true,
@@ -50,8 +49,9 @@ define([
5049

5150
getValue: function() {
5251
var colour = this.$el.spectrum('get');
53-
if (colour) return colour.toHexString();
54-
return '';
52+
if (!colour) return '';
53+
54+
return (colour.getAlpha() < 1) ? colour.toRgbString() : colour.toHexString();
5555
},
5656

5757
setValue: function(value) {

0 commit comments

Comments
 (0)