If a Pokémon has more than half of its HP, its HP bar remains green. If the Pokémon has between one-fifth and half of its HP, the bar will turn yellow (in Generation II, a Pokémon revived to exactly half of their HP will have a green HP bar). If a Pokémon has less than one-fifth of its HP remaining, the bar will turn red...
So, if HP > 50%, it will be green; if 50% > HP > 20%, it will be yellow (unless you revive in Gen II); and if HP < 20%, it will be red.
However, in Gen I, it was calculated inaccurately via pixels, causing the bar to turn yellow at about 56% of the max HP:
If the bar's fill was 27 pixels or wider (out of a total end-to-end length of 48 pixels), it would be colored green; if it was between 10 and 26 pixels, it would be colored yellow; and if it was less than 10 pixels wide, it would be colored red. This means the HP bar turns yellow noticeably earlier than in the later games, or at about 56% of the Pokémon's maximum HP.
I hope this answered your question.