Skip to content

Commit c31cfc4

Browse files
author
Joseph Atkins-Turkish
committed
Added Gray for SDK 3 B&W watches
1 parent f506854 commit c31cfc4

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

ide/static/ide/js/ib/canvas.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
// Window properties
3030
var mProperties = {
31-
bg: new IB.Properties.Colour(pgettext("background colour", "Background"), IB.ColourWhite),
31+
bg: new IB.Properties.Colour(pgettext("background colour", "Background"), IB.ColourWhite, true),
3232
fullscreen: new IB.Properties.Bool(gettext("Fullscreen"), CloudPebble.ProjectInfo.app_is_watchface || CloudPebble.ProjectInfo.sdk_version == '3')
3333
};
3434
mProperties.bg.on('change', handleBackgroundChange, this);

ide/static/ide/js/ib/layers/actionbarlayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
IB.Layer.call(this, canvas, id);
1212

1313
_.extend(this._properties, {
14-
bg: new IB.Properties.Colour(pgettext("background colour", "Background"), IB.ColourBlack),
14+
bg: new IB.Properties.Colour(pgettext("background colour", "Background"), IB.ColourBlack, true),
1515
icon_up: new IB.Properties.Bitmap(gettext("Top icon"), ""),
1616
icon_select: new IB.Properties.Bitmap(gettext("Middle icon"), ""),
1717
icon_down: new IB.Properties.Bitmap(gettext("Bottom icon"), "")

ide/static/ide/js/ib/layers/bitmaplayer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
IB.BitmapLayer = function(canvas, id) {
1010
IB.Layer.call(this, canvas, id);
1111
this._resource = new IB.Properties.Bitmap(gettext("Image"), '');
12-
this._bg_colour = new IB.Properties.Colour(pgettext("background colour", "Background"), IB.ColourClear);
12+
this._bg_colour = new IB.Properties.Colour(pgettext("background colour", "Background"), IB.ColourClear, true);
1313
this._has_changed_image = false;
1414
this._node.addClass('ib-bitmaplayer');
1515
this.setSize(40, 40);

ide/static/ide/js/ib/layers/textlayer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
_.extend(this._properties, {
1515
text: new IB.Properties.Text(gettext("Text"), pgettext("sample text", "Text layer")),
1616
font: new IB.Properties.Font(gettext("Font"), "GOTHIC_14_BOLD"),
17-
fg: new IB.Properties.Colour(gettext("Text colour"), IB.ColourBlack),
18-
bg: new IB.Properties.Colour(pgettext("background colour", "Background"), IB.ColourWhite),
17+
fg: new IB.Properties.Colour(gettext("Text colour"), IB.ColourBlack, false),
18+
bg: new IB.Properties.Colour(pgettext("background colour", "Background"), IB.ColourWhite, true),
1919
align: new IB.Properties.MultipleChoice(pgettext("horizontal text positioning", "Alignment"), {
2020
"GTextAlignmentLeft": gettext("Left"),
2121
"GTextAlignmentCenter": gettext("Centre"),

ide/static/ide/js/ib/properties.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@
195195
* @constructor
196196
* @extends {IB.Properties.Property}
197197
*/
198-
IB.Properties.Colour = function(name, value) {
198+
IB.Properties.Colour = function(name, value, is_fill) {
199+
this.is_fill = !!is_fill;
199200
Property.call(this, name, this._makeColours(value));
200201
if (IB.colourEnabled) {
201202
this._labelClass = 'ib-colour-label';
@@ -266,7 +267,7 @@
266267
},
267268
_generateNode: function() {
268269
var element;
269-
var mono_options = _.map(IB.MonochromeMap, this._createColour);
270+
var mono_options = _.map(IB.makeMonochromeMap(this.is_fill), this._createColour);
270271
this._bwNode = $('<select class="ib-property ib-colour">')
271272
.append(mono_options)
272273
.val(this._value[IB.ColourModes.Monochrome].name)

ide/static/ide/js/ib/utils.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@
4747
IB.ColourClear = IB.ColourMap['GColorClear'];
4848
IB.ColourWhite = IB.ColourMap['GColorWhite'];
4949
IB.ColourBlack = IB.ColourMap['GColorBlack'];
50-
51-
IB.MonochromeMap = {
52-
GColorWhite: IB.ColourWhite,
53-
GColorBlack: IB.ColourBlack,
54-
GColorClear: IB.ColourClear
50+
IB.DitheredGray = new IB.Colour('GColorLightGray', '#7F7F7F', 'Gray');
51+
IB.makeMonochromeMap = function(is_fill) {
52+
colour_map = {};
53+
colour_map['GColorWhite'] = IB.ColourWhite;
54+
if (is_fill && CloudPebble.ProjectInfo.sdk_version == "3") {
55+
colour_map['GColorLightGray'] = IB.DitheredGray;
56+
}
57+
colour_map['GColorBlack'] = IB.ColourBlack;
58+
colour_map['GColorClear'] = IB.ColourClear;
59+
return colour_map;
5560
};
5661

5762
/**

0 commit comments

Comments
 (0)