1
でランダムな16進数のカラー
を生成し、私はこのようなもので、背景として、たとえばそれを使用するために、小枝にランダム六角色を生成したいですか?は小枝
を生成し、私はこのようなもので、背景として、たとえばそれを使用するために、小枝にランダム六角色を生成したいですか?は小枝
私はあなたが次のように(何のセンス値を除外しないために)データのセットノウハウをランダム化することをお勧め:
{% for organization in organizations %}
{
value: {{ organization.value }},
color: "{{ random(['#H54924', '#F36252', '#F56954']) }}"
label: "{{ organization.name }}"
},
{% endfor %}
EDIT:
純粋なランダムな値については、次の方法を試すことができます:
{% set values = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']%}
{% for organization in organizations %}
{
value: {{ organization.value }},
color: "#{{random(values)~ random(values)~ random(values)~ random(values)~ random(values)~ random(values) }}",
label: "{{ organization.name }}"
},
{% endfor %}
{{ '#' ~ random(values) ~ random(values) ~ random(values) ~ random(values) ~ random(values) ~ random(values) }}
Here実施例
こんにちは、このヘルプ