Skip to content

Commit

Permalink
Added background_color_by_percentage method to LotteryHelper for dy…
Browse files Browse the repository at this point in the history
…namic background color generation based on percentage values.
  • Loading branch information
saisanthoshG committed Apr 22, 2024
1 parent 92a7f87 commit f111f8c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/helpers/lottery_helper.rb
@@ -1,2 +1,14 @@
module LotteryHelper
def background_color_by_percentage(percentage)
case percentage
when 0...33
'background-color: #ffcccc;' # Light red for low percentages
when 33...66
'background-color: #ffcc99;' # Light orange for medium percentages
when 66..100
'background-color: #ccffcc;' # Light green for high percentages
else
'background-color: none;' # No background if outside range
end
end
end

0 comments on commit f111f8c

Please sign in to comment.