Android Code Snippet Material Design Colors

ivan.tellez

Active Member
Licensed User
Yo can review the Guidelines For the use of colors in apps for Material design at google's site:

http://www.google.com/design/spec/style/color.html

I just put the colors in maps

B4X:
    Dim MaterialColors(19) As Map
 
For x1 = 0 To 18
    MaterialColors(x1).Initialize
Next

MaterialColors(0) = A2M(Array As Object(50, Colors.rgb(255, 235, 238), 100, Colors.rgb(255, 205, 210), 200, Colors.rgb(239, 154, 154), 300, Colors.rgb(229, 115, 115), 400, Colors.rgb(239, 83, 80), 500, Colors.rgb(244, 67, 54), 600, Colors.rgb(229, 57, 53), 700, Colors.rgb(211, 47, 47), 800, Colors.rgb(198, 40, 40), 900, Colors.rgb(183, 28, 28) ))
MaterialColors(1) = A2M(Array As Object(50, Colors.rgb(252, 228, 236), 100, Colors.rgb(248, 187, 208), 200, Colors.rgb(244, 143, 177), 300, Colors.rgb(240, 98, 146), 400, Colors.rgb(236, 64, 122), 500, Colors.rgb(233, 30, 99), 600, Colors.rgb(216, 27, 96), 700, Colors.rgb(194, 24, 91), 800, Colors.rgb(173, 20, 87), 900, Colors.rgb(136, 14, 79) ))
MaterialColors(2) = A2M(Array As Object(50, Colors.rgb(243, 229, 245), 100, Colors.rgb(225, 190, 231), 200, Colors.rgb(206, 147, 216), 300, Colors.rgb(186, 104, 200), 400, Colors.rgb(171, 71, 188), 500, Colors.rgb(156, 39, 176), 600, Colors.rgb(142, 36, 170), 700, Colors.rgb(123, 31, 162), 800, Colors.rgb(106, 27, 154), 900, Colors.rgb(74, 20, 140) ))
MaterialColors(3) = A2M(Array As Object(50, Colors.rgb(237, 231, 246), 100, Colors.rgb(209, 196, 233), 200, Colors.rgb(179, 157, 219), 300, Colors.rgb(149, 117, 205), 400, Colors.rgb(126, 87, 194), 500, Colors.rgb(103, 58, 183), 600, Colors.rgb(94, 53, 177), 700, Colors.rgb(81, 45, 168), 800, Colors.rgb(69, 39, 160), 900, Colors.rgb(49, 27, 146) ))
MaterialColors(4) = A2M(Array As Object(50, Colors.rgb(232, 234, 246), 100, Colors.rgb(197, 202, 233), 200, Colors.rgb(159, 168, 218), 300, Colors.rgb(121, 134, 203), 400, Colors.rgb(92, 107, 192), 500, Colors.rgb(63, 81, 181), 600, Colors.rgb(57, 73, 171), 700, Colors.rgb(48, 63, 159), 800, Colors.rgb(40, 53, 147), 900, Colors.rgb(26, 35, 126) ))
MaterialColors(5) = A2M(Array As Object(50, Colors.rgb(227, 242, 253), 100, Colors.rgb(187, 222, 251), 200, Colors.rgb(144, 202, 249), 300, Colors.rgb(100, 181, 246), 400, Colors.rgb(66, 165, 245), 500, Colors.rgb(33, 150, 243), 600, Colors.rgb(30, 136, 229), 700, Colors.rgb(25, 118, 210), 800, Colors.rgb(21, 101, 192), 900, Colors.rgb(13, 71, 161) ))
MaterialColors(6) = A2M(Array As Object(50, Colors.rgb(225, 245, 254), 100, Colors.rgb(179, 229, 252), 200, Colors.rgb(129, 212, 250), 300, Colors.rgb(79, 195, 247), 400, Colors.rgb(41, 182, 246), 500, Colors.rgb(3, 169, 244), 600, Colors.rgb(3, 155, 229), 700, Colors.rgb(2, 136, 209), 800, Colors.rgb(2, 119, 189), 900, Colors.rgb(1, 87, 155) ))
MaterialColors(7) = A2M(Array As Object(50, Colors.rgb(224, 247, 250), 100, Colors.rgb(178, 235, 242), 200, Colors.rgb(128, 222, 234), 300, Colors.rgb(77, 208, 225), 400, Colors.rgb(38, 198, 218), 500, Colors.rgb(0, 188, 212), 600, Colors.rgb(0, 172, 193), 700, Colors.rgb(0, 151, 167), 800, Colors.rgb(0, 131, 143), 900, Colors.rgb(96, 100, 0) ))
MaterialColors(8) = A2M(Array As Object(50, Colors.rgb(224, 242, 241), 100, Colors.rgb(178, 223, 219), 200, Colors.rgb(128, 203, 196), 300, Colors.rgb(77, 182, 172), 400, Colors.rgb(38, 166, 154), 500, Colors.rgb(150, 136, 0), 600, Colors.rgb(0, 137, 123), 700, Colors.rgb(0, 121, 107), 800, Colors.rgb(0, 105, 92), 900, Colors.rgb(0, 77, 64) ))
MaterialColors(9) = A2M(Array As Object(50, Colors.rgb(232, 245, 233), 100, Colors.rgb(200, 230, 201), 200, Colors.rgb(165, 214, 167), 300, Colors.rgb(129, 199, 132), 400, Colors.rgb(102, 187, 106), 500, Colors.rgb(76, 175, 80), 600, Colors.rgb(67, 160, 71), 700, Colors.rgb(56, 142, 60), 800, Colors.rgb(46, 125, 50), 900, Colors.rgb(27, 94, 32) ))
MaterialColors(10) = A2M(Array As Object(50, Colors.rgb(241, 248, 233), 100, Colors.rgb(220, 237, 200), 200, Colors.rgb(197, 225, 165), 300, Colors.rgb(174, 213, 129), 400, Colors.rgb(156, 204, 101), 500, Colors.rgb(139, 195, 74), 600, Colors.rgb(124, 179, 66), 700, Colors.rgb(104, 159, 56), 800, Colors.rgb(85, 139, 47), 900, Colors.rgb(51, 105, 30) ))
MaterialColors(11) = A2M(Array As Object(50, Colors.rgb(249, 251, 231), 100, Colors.rgb(240, 244, 195), 200, Colors.rgb(230, 238, 156), 300, Colors.rgb(220, 231, 117), 400, Colors.rgb(212, 225, 87), 500, Colors.rgb(205, 220, 57), 600, Colors.rgb(192, 202, 51), 700, Colors.rgb(175, 180, 43), 800, Colors.rgb(158, 157, 36), 900, Colors.rgb(130, 119, 23) ))
MaterialColors(12) = A2M(Array As Object(50, Colors.rgb(255, 253, 231), 100, Colors.rgb(255, 249, 196), 200, Colors.rgb(255, 245, 157), 300, Colors.rgb(255, 241, 118), 400, Colors.rgb(255, 238, 88), 500, Colors.rgb(255, 235, 59), 600, Colors.rgb(253, 216, 53), 700, Colors.rgb(251, 192, 45), 800, Colors.rgb(249, 168, 37), 900, Colors.rgb(245, 127, 23) ))
MaterialColors(13) = A2M(Array As Object(50, Colors.rgb(255, 248, 225), 100, Colors.rgb(255, 236, 179), 200, Colors.rgb(255, 224, 130), 300, Colors.rgb(255, 213, 79), 400, Colors.rgb(255, 202, 40), 500, Colors.rgb(255, 193, 7), 600, Colors.rgb(255, 179, 0), 700, Colors.rgb(255, 160, 0), 800, Colors.rgb(255, 143, 0), 900, Colors.rgb(255, 111, 0) ))
MaterialColors(14) = A2M(Array As Object(50, Colors.rgb(255, 243, 224), 100, Colors.rgb(255, 224, 178), 200, Colors.rgb(255, 204, 128), 300, Colors.rgb(255, 183, 77), 400, Colors.rgb(255, 167, 38), 500, Colors.rgb(255, 152, 0), 600, Colors.rgb(251, 140, 0), 700, Colors.rgb(245, 124, 0), 800, Colors.rgb(239, 108, 0), 900, Colors.rgb(230, 81, 0) ))
MaterialColors(15) = A2M(Array As Object(50, Colors.rgb(251, 233, 231), 100, Colors.rgb(255, 204, 188), 200, Colors.rgb(255, 171, 145), 300, Colors.rgb(255, 138, 101), 400, Colors.rgb(255, 112, 67), 500, Colors.rgb(255, 87, 34), 600, Colors.rgb(244, 81, 30), 700, Colors.rgb(230, 74, 25), 800, Colors.rgb(216, 67, 21), 900, Colors.rgb(191, 54, 12) ))
MaterialColors(16) = A2M(Array As Object(50, Colors.rgb(239, 235, 233), 100, Colors.rgb(215, 204, 200), 200, Colors.rgb(188, 170, 164), 300, Colors.rgb(161, 136, 127), 400, Colors.rgb(141, 110, 99), 500, Colors.rgb(121, 85, 72), 600, Colors.rgb(109, 76, 65), 700, Colors.rgb(93, 64, 55), 800, Colors.rgb(78, 52, 46), 900, Colors.rgb(62, 39, 35) ))
MaterialColors(17) = A2M(Array As Object(50, Colors.rgb(250, 250, 250), 100, Colors.rgb(245, 245, 245), 200, Colors.rgb(238, 238, 238), 300, Colors.rgb(224, 224, 224), 400, Colors.rgb(189, 189, 189), 500, Colors.rgb(158, 158, 158), 600, Colors.rgb(117, 117, 117), 700, Colors.rgb(97, 97, 97), 800, Colors.rgb(66, 66, 66), 900, Colors.rgb(33, 33, 33) ))
MaterialColors(18) = A2M(Array As Object(50, Colors.rgb(236, 239, 241), 100, Colors.rgb(207, 216, 220), 200, Colors.rgb(176, 190, 197), 300, Colors.rgb(144, 164, 174), 400, Colors.rgb(120, 144, 156), 500, Colors.rgb(96, 125, 139), 600, Colors.rgb(84, 110, 122), 700, Colors.rgb(69, 90, 100), 800, Colors.rgb(55, 71, 79), 900, Colors.rgb(38, 50, 56) ))






Sub A2M (arr() As Object) As Map
    Dim m As Map
    m.Initialize
    For i = 0 To arr.Length - 1 Step 2
        m.Put(arr(i), arr(i + 1))
    Next
    Return m
End Sub


Then you can use like this:


B4X:
Dim paletteIndex as Int = 6 'Light Blue
Button1.Color = MaterialColors(paletteIndex).Get(700)


I hope this could be useful to someone









Tags: Lollipop, Material Design, Android 5, Color palette, UI color application, Themes, Material Theme.
 
Last edited:
Top