I'd like to color the map using the "select by expression". I tried to use color_rgba(255, 0, 0, 255) for example. It only changes the color to be completely yellow which is the "selection color" in the general settings and project settings. So do I have to disable the selection color in the general settings somehow, or is there another way to use the color from the expression?

Edit: I basically want to color a map relative to the values of certain attributes. To give an example, I want to be able to color streets relative to their length with an expression which probably looks like the following: color_rgba(255, 0, 0, (length / max_length) * 255). Where would I specify such a coloring option?


You can change the selection color in the project properties tab but I suspect that isn't what you want.

If you just want to color in a selection of your data (possibly so you can add a second color to other values later) then you need to go to the styling tab of the layer properties (double click the layer or right click and select properties).

Then change single symbol to Rule-based: enter image description here

double click on the rule and enter your filter in the filter box (click the ... button to open the expression editor).

enter image description here

  • Thanks for the fast answer! I think that could solve the problem but if I enter my rule / filter (color_rgba(255, 0, 0, 255)) and apply it, the map is completely gone. – balderdash Jun 26 '17 at 9:05
  • You need an expression that evaluates to true for the features you want to colour. You set the colour further down the tab. – Ian Turton Jun 26 '17 at 12:29
  • I want to colorize the map of a city regarding the value of certain attributes, e.g. color_rgba(255, 0, 0, (income_mean/max_income)*255). – balderdash Jun 26 '17 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.