question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testing Ionic 4 - Standard color names are not recognized

See original GitHub issue

Bug Report / Feature Request ???

Ionic Info Run ionic info from a terminal/cmd prompt and paste the output below.

4.0.0-alpha.11

Describe the Bug Using a standard color name does not work for a component

Steps to Reproduce capture299

Related Code https://github.com/peterennis/ae-svg-components/blob/master/src/index.html#L34-L37

Expected Behavior Use known names (preferred) or hex codes Ref: https://en.wikipedia.org/wiki/Web_colors

Additional Context This commit refers to “The color to use from your application’s color palette.” https://github.com/ionic-team/ionic/commit/b4976dd914e47c78a743a640f1221836498c2153

I would like to use named colors in my component. It may be necessary to extend Ionic theming. Where is a good place to start?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
brandyscarneycommented, Jul 26, 2018

You can add new colors by creating classes that define them, for example with yellow it would be:

.ion-color-yellow {
  --ion-color-base: #ffff00;
  --ion-color-base-rgb: 255,255,0;
  --ion-color-contrast: #000000;
  --ion-color-contrast-rgb: 0,0,0;
  --ion-color-shade: #e0e000;
  --ion-color-tint: #ffff1a;
}

You could use our color generator to auto generate some of these values here: https://beta.ionicframework.com/docs/theming/color-generator/

We have some documentation on the different layers that make up a color and why they’re needed here: https://beta.ionicframework.com/docs/theming/advanced/#color-language

The documentation does need to be updated to include the new way of adding a color though.

Example for yellow:

<ion-button color="yellow">yellow</ion-button>
<ion-button class="activated" color="yellow">yellow.activated</ion-button>
screen shot 2018-07-26 at 1 47 01 pm
0reactions
ionitron-bot[bot]commented, Nov 25, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing Ionic 4 - Standard color names are not recognized ...
Ionic Info Run ionic info from a terminal/cmd prompt and paste the output below. ; Describe the Bug Using a standard color name...
Read more >
Style or Change Default App Colors - Ionic Framework
Ionic has nine default colors that can be used to change the color of many components. Learn how to utilize Ionic CSS color...
Read more >
'ionic' is not recognized as an internal or external command
Type cd\ now get into the npm path folder by cd <YourNpmPath>\npm install -g ionic@4; That's it . Now it is globally available...
Read more >
Beginner's Guide to Ionic Angular Unit Testing (Part 1) - Enappd
We begin explaining unit testing for Ionic apps and setting up environment using Karma Server and Jasmine.Next Spec file, TestBed, Jasmine.
Read more >
Unit testing an Ionic application with the Jest testing framework
For those who may be unaware a unit test involves testing the smallest possible piece of an application's code - typically a function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found