• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home » Resolved: How to change the color of a class based on data your recieving?

Resolved: How to change the color of a class based on data your recieving?

0
By Isaac Tonny on 16/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

Ok so I am working on a Random Pokémon Generator and every time the user clicks the generate button it picks a random number between 1-905(Number of Pokémon in National Dex). I am able to show the image, name/id, and typing of the Pokémon that is generated. What im stuck on is how to change the color of the background of the container/class that the Pokémon is displayed in based on the typing of said Pokémon. Say the Pokémon’s typing is grass I would want the background to be a green color. I really don’t know where to start to even do this.
I am using PokeApi

Answer:

1.Create a typeCss on object 2.Make css styles for all type


If you have better answer, please add a comment about this, thank you!

javascript multidimensional-array
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Passing 2 functions in onChange in react

24/03/2023

Resolved: Why doesn’t stringstream consume output during hex formatting?

24/03/2023

Resolved: CMake path for python3 libraries doesn’t change (windows 10)

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.