Skip to content

Instantly share code, notes, and snippets.

@soulcramer
Forked from nickbutcher/rainbow.xml
Created June 27, 2018 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soulcramer/7550e04d9dd7f88863ff3ccfcd5b99a1 to your computer and use it in GitHub Desktop.
Save soulcramer/7550e04d9dd7f88863ff3ccfcd5b99a1 to your computer and use it in GitHub Desktop.
Demonstrating using VectorDrawable gradients to create a rainbow effect. See https://twitter.com/crafty/status/1011922414983352320
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="360dp"
android:height="208dp"
android:viewportWidth="360"
android:viewportHeight="208">
<path android:pathData="M0,0 L360,0 L360,208 L0,208 Z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="360"
android:endY="208"
android:startX="0"
android:startY="0"
android:type="linear"
android:tileMode="repeat">
<item
android:color="#FF0064"
android:offset="0.0" />
<item
android:color="#FF0064"
android:offset="0.111111" />
<item
android:color="#FF7600"
android:offset="0.111111" />
<item
android:color="#FF7600"
android:offset="0.222222" />
<item
android:color="#FFD500"
android:offset="0.222222" />
<item
android:color="#FFD500"
android:offset="0.3333333" />
<item
android:color="#8CFE00"
android:offset="0.3333333" />
<item
android:color="#8CFE00"
android:offset="0.444444" />
<item
android:color="#00E86C"
android:offset="0.444444" />
<item
android:color="#00E86C"
android:offset="0.555555" />
<item
android:color="#00F4F2"
android:offset="0.555555" />
<item
android:color="#00F4F2"
android:offset="0.666666" />
<item
android:color="#00CCFF"
android:offset="0.666666" />
<item
android:color="#00CCFF"
android:offset="0.777777" />
<item
android:color="#70A2FF"
android:offset="0.777777" />
<item
android:color="#70A2FF"
android:offset="0.888888" />
<item
android:color="#A96CFF"
android:offset="0.888888" />
<item
android:color="#A96CFF"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
</vector>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment