# Adding multiple colors to CZML Line: Is it possible?

**URL:** <https://community.cesium.com/t/adding-multiple-colors-to-czml-line-is-it-possible/7051>\
**Category:** CesiumJS\
**Created:** [June 19, 2018, 5:30pm UTC](https://community.cesium.com/t/adding-multiple-colors-to-czml-line-is-it-possible/7051 "2018-06-19T17:30:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ubeyout755](https://avatars.discourse-cdn.com/v4/letter/u/ed655f/32.png) [@ubeyout755](https://community.cesium.com/u/ubeyout755)\
**Post date:** [June 19, 2018, 5:30pm UTC](https://community.cesium.com/t/adding-multiple-colors-to-czml-line-is-it-possible/7051/1 "2018-06-19T17:30:45Z")

</div>

1. A concise explanation of the problem you're experiencing.  
I am trying to give a CZML polyline file a multicolor property. The example from Brent Shanahan works within Cesium, but I would like add it to a file external to Cesium and load said file using Cesium.CzmlDatasource() load.  
More specifically, how do I add VERTEX\_FORMAT and more than one color to a CZML file?

Example Thread: [https://groups.google.com/forum/#!topic/cesium-dev/FKfcfuw2TpI](https://groups.google.com/forum/#!topic/cesium-dev/FKfcfuw2TpI)

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.  
//This is the code that works in Cesium:  
var viewer = new Cesium.Viewer('cesiumContainer');

var primitive = new Cesium.Primitive({  
&nbsp;&nbsp;geometryInstances : new Cesium.GeometryInstance({  
&nbsp;&nbsp;&nbsp;&nbsp;geometry : new Cesium.PolylineGeometry({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;positions : [  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cesium.Cartesian3.fromElements(-2822918.76, -1347627.64, 5539750.33),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cesium.Cartesian3.fromElements(-2860091, -1790883.7, 6104936.09),  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cesium.Cartesian3.fromElements(-2869994.31, -2212991.67, 6598178.01)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;width : 2.0,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vertexFormat : Cesium.PolylineColorAppearance.VERTEX\_FORMAT,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;colors: [Cesium.Color.RED, Cesium.Color.BLUE],  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;colorsPerVertex: true  
&nbsp;&nbsp;&nbsp;&nbsp;})  
&nbsp;&nbsp;}),  
&nbsp;&nbsp;appearance : new Cesium.PolylineColorAppearance({  
&nbsp;&nbsp;&nbsp;&nbsp;translucent : false  
&nbsp;&nbsp;})  
});

viewer.scene.primitives.add(primitive);

/\* The sections I am trying to get into the CZML file  
\* are vertexFormat and colors.  
\*/

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.  
I am dynamically updating a CZML file during a flight and making the line color a gradient will improve readability as the line crosses itself repeatedly (it looks like a clump of red in certain locations).

4. The Cesium version you're using, your operating system and browser.  
Cesium 1.43  
Windows & Linux  
Chrome/Chromium-Browser

---

<div class="post-metadata">

**Author:** ![Scott\_Hunter](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/scott_hunter/32/2006_2.png) [@Scott\_Hunter](https://community.cesium.com/u/Scott_Hunter)\
**Post date:** [June 20, 2018, 8:52pm UTC](https://community.cesium.com/t/adding-multiple-colors-to-czml-line-is-it-possible/7051/2 "2018-06-20T20:52:10Z")

</div>

The entity layer (and by extension CZML) does not currently support specifying colorsPerVertex. This is discussed as an open future enhancement here: [https://github.com/AnalyticalGraphicsInc/cesium/issues/4393](https://github.com/AnalyticalGraphicsInc/cesium/issues/4393)
