INNER CODE UNIT · Ruby
alpha
Automattic/pocket-casts-android · scripts/themes/generate_xml.rb:43
alpha = (opacity[0...-1].to_f / 100.0 * 255.0).to_i.to_s(16)
alpha = "0#{alpha}" if alpha.size == 1
color_with_alpha = opacity == '100%' ? color : "##{alpha}#{color[1..]}"
output += %( <item name="#{key}">#{color_with_alpha}</item>\n)
end
write_to_theme_file(output, file_marker)
end
tokens = download_themes
exit if tokens.nil?
write_theme_attrs(tokens)
write_theme_colors(tokens, 'light', 'Light theme tokens')
write_theme_colors(tokens, 'dark', 'Dark theme tokens')
write_theme_colors(tokens, 'extra_dark', 'Extra dark theme tokens')
write_theme_colors(tokens, 'classic_light', 'Classic light theme tokens')
write_theme_colors(tokens, 'electricity', 'Electricity theme tokens')
write_theme_colors(tokens, 'indigo', 'Indigo theme tokens')