Book a Demo

Author Topic: Find out colour of an element?  (Read 3949 times)

joh

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Find out colour of an element?
« on: December 11, 2018, 07:45:25 pm »
Hello all,

i have a question:
Is it possible to find out the colour of an EA-element?
I can not find the colour setting in the element properties...so I would like to write a script which will find out the colour.

Thanks so much.

BR
Joh

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Find out colour of an element?
« Reply #1 on: December 11, 2018, 08:22:16 pm »
Not that easy.

Colors can be defined at various levels

- There is a global default for the color of elements
- Diagram profiles can show elements in different colors
- Shapescripts (linked to stereotypes) can define colors
- Elements can have a default color
- Elements can have a specific color on a specific diagram
- Diagram legends can dynamically change the color of an element on a specific diagram

To get the exact color for an element a person is seeing on a diagram you would have to take all of these into account (and maybe some I missed)

Geert

joh

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Find out colour of an element?
« Reply #2 on: December 11, 2018, 08:32:28 pm »
Ok, thanks, but how can I find it out via script? :o

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Find out colour of an element?
« Reply #3 on: December 11, 2018, 08:44:22 pm »
Ok, thanks, but how can I find it out via script? :o

I think I wasn't clear enough on the "not that easy" part.
What I meant was "really difficult, borderline impossible"
If you would ask me to give you an estimate on how long it would take me to write a script to give you the exact color of an element in a diagram, I would probably estimate it to be at least 4 solid weeks of work. (and I have a bit experience writing scripts in EA)

I suggest you find another way to get what you need.

Geert

joh

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Find out colour of an element?
« Reply #4 on: December 11, 2018, 08:47:48 pm »
Oh ok, thanks.

I didn't know that it is so difficult.

I will use the work-around with the "colour-picker" tool in the colour properties of the element. So I can pick the color of the element and can use the RGB values.

BR

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Find out colour of an element?
« Reply #5 on: December 11, 2018, 10:09:38 pm »
If the color happens to come from a shape script you're almost out of luck. Even if you can find the source in the MDG (which happens to be most difficult) you would need to interpret the shape script in it's context. Maybe, if you have it on a diagram there might be ways to figure out the pixel color of a screen area you identify being the element. And then hopefully you get the right place where no icon/text or so is drawn.

q.