Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 0306ac0

Browse files
jagmeetbjelbourn
authored andcommitted
fix(theme): prepend # to hex codes enableBrowserColor (#11492)
check for leading # and prepend update enableBrowserColor tests Fixes #11259
1 parent 4d29450 commit 0306ac0

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/core/services/theming/theming.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ function ThemingProvider($mdColorPalette, $$mdMetaProvider) {
281281
PALETTES[THEMES[theme].colors[options.palette || 'primary'].name];
282282

283283
var color = angular.isObject(palette[hue]) ? palette[hue].hex : palette[hue];
284+
if (color.substr(0, 1) !== '#') color = '#' + color;
284285

285286
return setBrowserColor(color);
286287
};

src/core/services/theming/theming.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ describe('$mdThemingProvider', function() {
363363

364364
it('should use default primary color at the meta tag', function () {
365365
var name = 'theme-color';
366-
var content = themingProvider._PALETTES.testPalette['800'].hex;
366+
var content = '#' + themingProvider._PALETTES.testPalette['800'].hex;
367367

368368
expect(document.getElementsByName(name).length).toBe(0);
369369

@@ -378,7 +378,7 @@ describe('$mdThemingProvider', function() {
378378

379379
var hue = '200';
380380

381-
var content = themingProvider._PALETTES.testPalette[hue].hex;
381+
var content = '#' + themingProvider._PALETTES.testPalette[hue].hex;
382382

383383
expect(document.getElementsByName(name).length).toBe(0);
384384

@@ -404,7 +404,7 @@ describe('$mdThemingProvider', function() {
404404
it('should use test theme', function () {
405405
var name = 'theme-color';
406406

407-
var content = themingProvider._PALETTES.testPalette['800'].hex;
407+
var content = '#' + themingProvider._PALETTES.testPalette['800'].hex;
408408

409409
expect(document.getElementsByName(name).length).toBe(0);
410410

0 commit comments

Comments
 (0)