"The" applies any time when you are referring to a single unique item in a set. Adding more adjectives makes your reference more and more specific, and at some point there may be only one thing that meets that description, and then it appropriate to use "the".
For example, let's say you are in a hat shop, trying to get a specific red hat. If you ask for "the red hat", they will be confused because the shop has many red hats and they don't know which one you mean. Instead you would say "a red hat", indicating that any red hat will do.
Alternately, you could keep adding adjectives until you reach something unique. You could instead ask for "the large, red, sparkly hat with a peacock feather". There is only one of those, so there is no confusion.
It can be a little more confusing than this. Take your example:
The Asian elephant has smaller ears than the African elephant.
This works because "the Asian elephant" refers to the genus Elephas, commonly known as the Asian elephant, and African elephant refers to the genus Loxodonta. So they are talking about these two groups in specific, rather than any elephant from Asia, or any elephant from Africa. Otherwise, it would only be appropriate if they had a group of elephants that they had previously referred to, and only on of those was Asian and only one was African.
You also expressed some confusion on "the color green" vs "the green color". "The color green" refers to a specific color that is named "green". Although many colors are green, every manufacturer of pigments has one color they consider to be the true green and so they name it green. If you open a box of Crayola crayons, for instance, many of them will be a green color, but only one of them will be labelled "Green". That is the one that someone would be referring to if they asked you to pass "the color green". On the other hand, "a green color" is a color that is green. All of the crayons in that box that have a mix of blue and yellow pigments would fall into this category. To be able to use the definite article, you need to narrow it down further. If you were admiring a car that was painted some shade of green, you could say "I really like the green color on that car", because you are referring specifically to the color that is on the car, and no other green.
In the case of "the DOM tree", you are referring either to a single DOM tree, or to the abstract concept of DOM trees in general. While many things qualify as DOM trees, there is only one class of trees referred to as "DOM tree" and so the definite article is appropriate. If you had several DOM trees, you would not use the definite article, but if you had several different trees, and one of them was a DOM tree, you could refer to that one specifically by saying "the DOM tree".
You can use the word "the" any time when there is a single definite thing you are talking about, and you can use adjectives to narrow down your subject until there is only one single definite thing that meets your description.