spatialillusions / milsymbol

Military Symbols in JavaScript
www.spatialillusions.com/milsymbol
MIT License
571 stars 139 forks source link

monoColor #265

Closed muby closed 1 year ago

muby commented 2 years ago

Hello,

I would to know there is a simple way to get MonoColor that can take a string like today or a ColorMode ?

Thanks a lot

spatialillusions commented 2 years ago

Hi,

You can override the built in color mode FrameColor.

https://github.com/spatialillusions/milsymbol/tree/master/docs#msgetcolormodemode

That should solve your problem.

/Måns

On 16 Feb 2022, at 00:06, Muby @.***> wrote:

 Hello,

I would to know there is a simple way to get MonoColor that can take a string like today or a ColorMode ?

Thanks a lot

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.

muby commented 2 years ago

I think I was not clear or I don't understand you answer :)

What I want to do is to be able to assign ColorMode to monoColor.

For example : Working :

new ms.Symbol("SFGPEVAC--**--*", {
      }, {standard:"APP6",monoColor:"red",size:200}).asSVG()

or

Not Working

new ms.Symbol("SFGPEVAC--**--*", {
      }, {standard:"APP6",monoColor:ms.ColorMode("purple", "blue", "red", "green", "yellow"),size:200}).asSVG()
new ms.Symbol("SFGPEVAC--**--*", {
      }, {standard:"APP6",monoColor:ms.getColorMode("Light"),size:200}).asSVG()
spatialillusions commented 1 year ago

If you first override the frame colormode:

let fs = ms.getColorMode("FrameColor")
fs.Civilian = "purple"
fs.Friend = "blue"
fs.Hostile = "red"
fs.Neutral = "green"
fs.Unknown = "yellow"

// Not sure if you have to do this
ms.setColorMode("FrameColor", fs)

Then you will get your symbols as you want, if you request them unfilled:

new ms.Symbol("SFGPEVAC--**--*", {
      }, {standard:"APP6",fill:false,size:200}).asSVG()