b = hex[5..6] ints = [] [r, g, b].each do |s| ints << s.hex end ints end def to_ints(hex) hex.scan(/\w\w/).map(&:hex) end class RgbTest < Minitest::Test def test_to_ints assert_equal [0, 0, 0], to_ints('#000000') assert_equal [255, 255, 255], to_ints('#ffffff') assert_equal [4, 60, 120], to_ints('#043c78') end end 16ਐͷ৭ίʔυΛ10ਐʹมͰ͖Δ͜ͱΛݕূ ϦϑΝΫλϦϯάલ ϦϑΝΫλϦϯάޙ ✨ in 16ਐ out 10ਐ