Modify colour transparency. Vectorised in both colour and alpha.

alpha(colour, alpha = NA)

Arguments

colour

colour

alpha

new alpha level in [0,1]. If alpha is NA, existing alpha values are preserved.

Examples

alpha("red", 0.1)
#> [1] "#FF00001A"
alpha(colours(), 0.5)
#> [1] "#FFFFFF80" "#F0F8FF80" "#FAEBD780" "#FFEFDB80" "#EEDFCC80" "#CDC0B080" #> [7] "#8B837880" "#7FFFD480" "#7FFFD480" "#76EEC680" "#66CDAA80" "#458B7480" #> [13] "#F0FFFF80" "#F0FFFF80" "#E0EEEE80" "#C1CDCD80" "#838B8B80" "#F5F5DC80" #> [19] "#FFE4C480" "#FFE4C480" "#EED5B780" "#CDB79E80" "#8B7D6B80" "#00000080" #> [25] "#FFEBCD80" "#0000FF80" "#0000FF80" "#0000EE80" "#0000CD80" "#00008B80" #> [31] "#8A2BE280" "#A52A2A80" "#FF404080" "#EE3B3B80" "#CD333380" "#8B232380" #> [37] "#DEB88780" "#FFD39B80" "#EEC59180" "#CDAA7D80" "#8B735580" "#5F9EA080" #> [43] "#98F5FF80" "#8EE5EE80" "#7AC5CD80" "#53868B80" "#7FFF0080" "#7FFF0080" #> [49] "#76EE0080" "#66CD0080" "#458B0080" "#D2691E80" "#FF7F2480" "#EE762180" #> [55] "#CD661D80" "#8B451380" "#FF7F5080" "#FF725680" "#EE6A5080" "#CD5B4580" #> [61] "#8B3E2F80" "#6495ED80" "#FFF8DC80" "#FFF8DC80" "#EEE8CD80" "#CDC8B180" #> [67] "#8B887880" "#00FFFF80" "#00FFFF80" "#00EEEE80" "#00CDCD80" "#008B8B80" #> [73] "#00008B80" "#008B8B80" "#B8860B80" "#FFB90F80" "#EEAD0E80" "#CD950C80" #> [79] "#8B650880" "#A9A9A980" "#00640080" "#A9A9A980" "#BDB76B80" "#8B008B80" #> [85] "#556B2F80" "#CAFF7080" "#BCEE6880" "#A2CD5A80" "#6E8B3D80" "#FF8C0080" #> [91] "#FF7F0080" "#EE760080" "#CD660080" "#8B450080" "#9932CC80" "#BF3EFF80" #> [97] "#B23AEE80" "#9A32CD80" "#68228B80" "#8B000080" "#E9967A80" "#8FBC8F80" #> [103] "#C1FFC180" "#B4EEB480" "#9BCD9B80" "#698B6980" "#483D8B80" "#2F4F4F80" #> [109] "#97FFFF80" "#8DEEEE80" "#79CDCD80" "#528B8B80" "#2F4F4F80" "#00CED180" #> [115] "#9400D380" "#FF149380" "#FF149380" "#EE128980" "#CD107680" "#8B0A5080" #> [121] "#00BFFF80" "#00BFFF80" "#00B2EE80" "#009ACD80" "#00688B80" "#69696980" #> [127] "#69696980" "#1E90FF80" "#1E90FF80" "#1C86EE80" "#1874CD80" "#104E8B80" #> [133] "#B2222280" "#FF303080" "#EE2C2C80" "#CD262680" "#8B1A1A80" "#FFFAF080" #> [139] "#228B2280" "#DCDCDC80" "#F8F8FF80" "#FFD70080" "#FFD70080" "#EEC90080" #> [145] "#CDAD0080" "#8B750080" "#DAA52080" "#FFC12580" "#EEB42280" "#CD9B1D80" #> [151] "#8B691480" "#BEBEBE80" "#00000080" "#03030380" "#05050580" "#08080880" #> [157] "#0A0A0A80" "#0D0D0D80" "#0F0F0F80" "#12121280" "#14141480" "#17171780" #> [163] "#1A1A1A80" "#1C1C1C80" "#1F1F1F80" "#21212180" "#24242480" "#26262680" #> [169] "#29292980" "#2B2B2B80" "#2E2E2E80" "#30303080" "#33333380" "#36363680" #> [175] "#38383880" "#3B3B3B80" "#3D3D3D80" "#40404080" "#42424280" "#45454580" #> [181] "#47474780" "#4A4A4A80" "#4D4D4D80" "#4F4F4F80" "#52525280" "#54545480" #> [187] "#57575780" "#59595980" "#5C5C5C80" "#5E5E5E80" "#61616180" "#63636380" #> [193] "#66666680" "#69696980" "#6B6B6B80" "#6E6E6E80" "#70707080" "#73737380" #> [199] "#75757580" "#78787880" "#7A7A7A80" "#7D7D7D80" "#7F7F7F80" "#82828280" #> [205] "#85858580" "#87878780" "#8A8A8A80" "#8C8C8C80" "#8F8F8F80" "#91919180" #> [211] "#94949480" "#96969680" "#99999980" "#9C9C9C80" "#9E9E9E80" "#A1A1A180" #> [217] "#A3A3A380" "#A6A6A680" "#A8A8A880" "#ABABAB80" "#ADADAD80" "#B0B0B080" #> [223] "#B3B3B380" "#B5B5B580" "#B8B8B880" "#BABABA80" "#BDBDBD80" "#BFBFBF80" #> [229] "#C2C2C280" "#C4C4C480" "#C7C7C780" "#C9C9C980" "#CCCCCC80" "#CFCFCF80" #> [235] "#D1D1D180" "#D4D4D480" "#D6D6D680" "#D9D9D980" "#DBDBDB80" "#DEDEDE80" #> [241] "#E0E0E080" "#E3E3E380" "#E5E5E580" "#E8E8E880" "#EBEBEB80" "#EDEDED80" #> [247] "#F0F0F080" "#F2F2F280" "#F5F5F580" "#F7F7F780" "#FAFAFA80" "#FCFCFC80" #> [253] "#FFFFFF80" "#00FF0080" "#00FF0080" "#00EE0080" "#00CD0080" "#008B0080" #> [259] "#ADFF2F80" "#BEBEBE80" "#00000080" "#03030380" "#05050580" "#08080880" #> [265] "#0A0A0A80" "#0D0D0D80" "#0F0F0F80" "#12121280" "#14141480" "#17171780" #> [271] "#1A1A1A80" "#1C1C1C80" "#1F1F1F80" "#21212180" "#24242480" "#26262680" #> [277] "#29292980" "#2B2B2B80" "#2E2E2E80" "#30303080" "#33333380" "#36363680" #> [283] "#38383880" "#3B3B3B80" "#3D3D3D80" "#40404080" "#42424280" "#45454580" #> [289] "#47474780" "#4A4A4A80" "#4D4D4D80" "#4F4F4F80" "#52525280" "#54545480" #> [295] "#57575780" "#59595980" "#5C5C5C80" "#5E5E5E80" "#61616180" "#63636380" #> [301] "#66666680" "#69696980" "#6B6B6B80" "#6E6E6E80" "#70707080" "#73737380" #> [307] "#75757580" "#78787880" "#7A7A7A80" "#7D7D7D80" "#7F7F7F80" "#82828280" #> [313] "#85858580" "#87878780" "#8A8A8A80" "#8C8C8C80" "#8F8F8F80" "#91919180" #> [319] "#94949480" "#96969680" "#99999980" "#9C9C9C80" "#9E9E9E80" "#A1A1A180" #> [325] "#A3A3A380" "#A6A6A680" "#A8A8A880" "#ABABAB80" "#ADADAD80" "#B0B0B080" #> [331] "#B3B3B380" "#B5B5B580" "#B8B8B880" "#BABABA80" "#BDBDBD80" "#BFBFBF80" #> [337] "#C2C2C280" "#C4C4C480" "#C7C7C780" "#C9C9C980" "#CCCCCC80" "#CFCFCF80" #> [343] "#D1D1D180" "#D4D4D480" "#D6D6D680" "#D9D9D980" "#DBDBDB80" "#DEDEDE80" #> [349] "#E0E0E080" "#E3E3E380" "#E5E5E580" "#E8E8E880" "#EBEBEB80" "#EDEDED80" #> [355] "#F0F0F080" "#F2F2F280" "#F5F5F580" "#F7F7F780" "#FAFAFA80" "#FCFCFC80" #> [361] "#FFFFFF80" "#F0FFF080" "#F0FFF080" "#E0EEE080" "#C1CDC180" "#838B8380" #> [367] "#FF69B480" "#FF6EB480" "#EE6AA780" "#CD609080" "#8B3A6280" "#CD5C5C80" #> [373] "#FF6A6A80" "#EE636380" "#CD555580" "#8B3A3A80" "#FFFFF080" "#FFFFF080" #> [379] "#EEEEE080" "#CDCDC180" "#8B8B8380" "#F0E68C80" "#FFF68F80" "#EEE68580" #> [385] "#CDC67380" "#8B864E80" "#E6E6FA80" "#FFF0F580" "#FFF0F580" "#EEE0E580" #> [391] "#CDC1C580" "#8B838680" "#7CFC0080" "#FFFACD80" "#FFFACD80" "#EEE9BF80" #> [397] "#CDC9A580" "#8B897080" "#ADD8E680" "#BFEFFF80" "#B2DFEE80" "#9AC0CD80" #> [403] "#68838B80" "#F0808080" "#E0FFFF80" "#E0FFFF80" "#D1EEEE80" "#B4CDCD80" #> [409] "#7A8B8B80" "#EEDD8280" "#FFEC8B80" "#EEDC8280" "#CDBE7080" "#8B814C80" #> [415] "#FAFAD280" "#D3D3D380" "#90EE9080" "#D3D3D380" "#FFB6C180" "#FFAEB980" #> [421] "#EEA2AD80" "#CD8C9580" "#8B5F6580" "#FFA07A80" "#FFA07A80" "#EE957280" #> [427] "#CD816280" "#8B574280" "#20B2AA80" "#87CEFA80" "#B0E2FF80" "#A4D3EE80" #> [433] "#8DB6CD80" "#607B8B80" "#8470FF80" "#77889980" "#77889980" "#B0C4DE80" #> [439] "#CAE1FF80" "#BCD2EE80" "#A2B5CD80" "#6E7B8B80" "#FFFFE080" "#FFFFE080" #> [445] "#EEEED180" "#CDCDB480" "#8B8B7A80" "#32CD3280" "#FAF0E680" "#FF00FF80" #> [451] "#FF00FF80" "#EE00EE80" "#CD00CD80" "#8B008B80" "#B0306080" "#FF34B380" #> [457] "#EE30A780" "#CD299080" "#8B1C6280" "#66CDAA80" "#0000CD80" "#BA55D380" #> [463] "#E066FF80" "#D15FEE80" "#B452CD80" "#7A378B80" "#9370DB80" "#AB82FF80" #> [469] "#9F79EE80" "#8968CD80" "#5D478B80" "#3CB37180" "#7B68EE80" "#00FA9A80" #> [475] "#48D1CC80" "#C7158580" "#19197080" "#F5FFFA80" "#FFE4E180" "#FFE4E180" #> [481] "#EED5D280" "#CDB7B580" "#8B7D7B80" "#FFE4B580" "#FFDEAD80" "#FFDEAD80" #> [487] "#EECFA180" "#CDB38B80" "#8B795E80" "#00008080" "#00008080" "#FDF5E680" #> [493] "#6B8E2380" "#C0FF3E80" "#B3EE3A80" "#9ACD3280" "#698B2280" "#FFA50080" #> [499] "#FFA50080" "#EE9A0080" "#CD850080" "#8B5A0080" "#FF450080" "#FF450080" #> [505] "#EE400080" "#CD370080" "#8B250080" "#DA70D680" "#FF83FA80" "#EE7AE980" #> [511] "#CD69C980" "#8B478980" "#EEE8AA80" "#98FB9880" "#9AFF9A80" "#90EE9080" #> [517] "#7CCD7C80" "#548B5480" "#AFEEEE80" "#BBFFFF80" "#AEEEEE80" "#96CDCD80" #> [523] "#668B8B80" "#DB709380" "#FF82AB80" "#EE799F80" "#CD688980" "#8B475D80" #> [529] "#FFEFD580" "#FFDAB980" "#FFDAB980" "#EECBAD80" "#CDAF9580" "#8B776580" #> [535] "#CD853F80" "#FFC0CB80" "#FFB5C580" "#EEA9B880" "#CD919E80" "#8B636C80" #> [541] "#DDA0DD80" "#FFBBFF80" "#EEAEEE80" "#CD96CD80" "#8B668B80" "#B0E0E680" #> [547] "#A020F080" "#9B30FF80" "#912CEE80" "#7D26CD80" "#551A8B80" "#FF000080" #> [553] "#FF000080" "#EE000080" "#CD000080" "#8B000080" "#BC8F8F80" "#FFC1C180" #> [559] "#EEB4B480" "#CD9B9B80" "#8B696980" "#4169E180" "#4876FF80" "#436EEE80" #> [565] "#3A5FCD80" "#27408B80" "#8B451380" "#FA807280" "#FF8C6980" "#EE826280" #> [571] "#CD705480" "#8B4C3980" "#F4A46080" "#2E8B5780" "#54FF9F80" "#4EEE9480" #> [577] "#43CD8080" "#2E8B5780" "#FFF5EE80" "#FFF5EE80" "#EEE5DE80" "#CDC5BF80" #> [583] "#8B868280" "#A0522D80" "#FF824780" "#EE794280" "#CD683980" "#8B472680" #> [589] "#87CEEB80" "#87CEFF80" "#7EC0EE80" "#6CA6CD80" "#4A708B80" "#6A5ACD80" #> [595] "#836FFF80" "#7A67EE80" "#6959CD80" "#473C8B80" "#70809080" "#C6E2FF80" #> [601] "#B9D3EE80" "#9FB6CD80" "#6C7B8B80" "#70809080" "#FFFAFA80" "#FFFAFA80" #> [607] "#EEE9E980" "#CDC9C980" "#8B898980" "#00FF7F80" "#00FF7F80" "#00EE7680" #> [613] "#00CD6680" "#008B4580" "#4682B480" "#63B8FF80" "#5CACEE80" "#4F94CD80" #> [619] "#36648B80" "#D2B48C80" "#FFA54F80" "#EE9A4980" "#CD853F80" "#8B5A2B80" #> [625] "#D8BFD880" "#FFE1FF80" "#EED2EE80" "#CDB5CD80" "#8B7B8B80" "#FF634780" #> [631] "#FF634780" "#EE5C4280" "#CD4F3980" "#8B362680" "#40E0D080" "#00F5FF80" #> [637] "#00E5EE80" "#00C5CD80" "#00868B80" "#EE82EE80" "#D0209080" "#FF3E9680" #> [643] "#EE3A8C80" "#CD327880" "#8B225280" "#F5DEB380" "#FFE7BA80" "#EED8AE80" #> [649] "#CDBA9680" "#8B7E6680" "#F5F5F580" "#FFFF0080" "#FFFF0080" "#EEEE0080" #> [655] "#CDCD0080" "#8B8B0080" "#9ACD3280"
alpha("red", seq(0, 1, length.out = 10))
#> [1] "#FF000000" "#FF00001C" "#FF000039" "#FF000055" "#FF000071" "#FF00008E" #> [7] "#FF0000AA" "#FF0000C6" "#FF0000E3" "#FF0000FF"