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

theme: enableBrowserColor fails silently if HEX color doesn't have a # at the start #11259

@mymattcarroll

Description

@mymattcarroll

Bug:

$mdThemingProvider.enableBrowserColor() does not work when using a custom palette

What is the expected behavior?

Browser colour should change to the custom palette colour

What is the current behavior?

Browser does not have colour at all.

CodePen and steps to reproduce the issue:

CodePen Demo which shows your issue:

Only works on a Mobile so here is some code:

$mdThemingProvider.definePalette('myorange', {
  '50': 'fcf2e0',
  '100': 'f7deb3',
  '200': 'f2c880',
  '300': 'edb14d',
  '400': 'e9a126',
  '500': 'e59000',
  '600': 'e28800',
  '700': 'de7d00',
  '800': 'da7300',
  '900': 'd36100',
  'A100': 'fffcfb',
  'A200': 'ffdec8',
  'A400': 'ffbf95',
  'A700': 'ffaf7b',
  'contrastDefaultColor': 'light',
  'contrastDarkColors': [
    '50',
    '100',
    '200',
    '300',
    '400',
    'A100',
    'A200'
  ],
  'contrastLightColors': [
    '500',
    '600',
    '700',
    '800',
    '900',
    'A400',
    'A700'
  ]
})
$mdThemingProvider.definePalette('mygrey', {
  '50': 'e5e6e6',
  '100': 'bec0c1',
  '200': '929698',
  '300': '666b6e',
  '400': '464c4f',
  '500': '252c30',
  '600': '21272b',
  '700': '1b2124',
  '800': '161b1e',
  '900': '0d1013',
  'A100': '58acff',
  'A200': '2592ff',
  'A400': '0079f1',
  'A700': '006cd8',
  'contrastDefaultColor': 'light',
  'contrastDarkColors': [
    '50',
    '100',
    'A100'
  ],
  'contrastLightColors': [
    '200',
    '300',
    '400',
    '500',
    '600',
    '700',
    '800',
    '900',
    'A200',
    'A400',
    'A700'
  ]
})

$mdThemingProvider.theme('default')
  .primaryPalette('myorange')
  .accentPalette('mygrey')
$mdThemingProvider.enableBrowserColor({
  palette: 'myorange'
})
Detailed Reproduction Steps:

See above code snippet.

What is the use-case or motivation for changing an existing behavior?

I want to be able to use my custom palette to change mobile browsers

Which versions of AngularJS, Material, OS, and browsers are affected?

  • AngularJS: 1.6.9
  • AngularJS Material: 1.1.8
  • OS: Android 7
  • Mobile Browsers:
    • Samsung Internet
    • Google Chrome

Is there anything else we should know? Stack Traces, Screenshots, etc.

n/a

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions