Colors

Note

Bing Maps Web Control SDK retirement

Bing Maps Web Control SDK is deprecated and will be retired. Free (Basic) account customers can continue to use Bing Maps Web Control SDK until June 30th, 2025. Enterprise account customers can continue to use Bing Maps Web Control SDK until June 30th, 2028. To avoid service disruptions, all implementations using Bing Maps Web Control SDK will need to be updated to use Azure Maps Web SDK by the retirement date that applies to your Bing Maps for Enterprise account type. For detailed migration guidance, see Migrate Bing Maps Enterprise applications to Azure Maps with GitHub Copilot.

Azure Maps is Microsoft's next-generation maps and geospatial services for developers. Azure Maps has many of the same features as Bing Maps for Enterprise, and more. To get started with Azure Maps, create a free Azure subscription and an Azure Maps account. For more information about azure Maps, see Azure Maps Documentation. For migration guidance, see Bing Maps Migration Overview.

Colors are used by a number of classes in Bing Maps such as Polylines and Polygons and can be specified in one of two ways. The first method is to use CSS3 color strings. All CSS3 colors are supported, including extended named colors. Here are some examples of the different CSS3 color strings you can use.

Color Type Example Description
Hex Color #ff0000 This would be the color red. This format does not support transparency.
RGB rgb(0, 255, 0) This would be the color green. This format does not support transparency.
RGBA rgba(0, 255, 0, 0.5) This would be the color green with 50% transparency.
HSL hsl(0, 100%, 50%) HSL stands for Hue-Saturation-Lightness. This example would be the color red. This format does not support transparency.
HSLA hsla(0, 100%, 50%, 0.4) This would be the color red with a 40% transparency.
Color Name red This would be the color red. This format does not support transparency.
Extend Color Name deepskyblue This would be a deep sky blue color. This format does not support transparency.

The second way to define a color in Bing Maps is by using the Microsoft.Maps.Color class.

The benefit of using the Color class over CSS3 color strings is that you can easily access the individual properties of the color in a programmatic way.

References