2

Does anybody know if it is possible to change the colors of the names of the columns (attributes) when writing a query in QGIS? (e.g. when selecting by expression in the attributes table).

  • 1
    I think you can only set the colours using the expression in the Conditional formatting option and not via the attribute selection. – Joseph Sep 3 '19 at 10:07
  • Do you want to change the colors of the column headers in the attribute table? Or do you want to change the color of the font used for field names in the expression builder? – csk Sep 3 '19 at 18:33
  • Field names in the expression builder are blue if you type them without double-quotation marks. They're yellow if you type the with double-quotation marks. As far as I know that's the only control you have over that. – csk Sep 3 '19 at 18:36
1

In the default user interface theme, the field names in the expression builder are

  • blue when typed without double quotation marks (fieldname)
  • yellow when typed with double quotation marks: ("fieldname")

enter image description here

If you switch to "night mapping" theme (settings > options > general > application > UI Theme), the field names will be

  • green when typed without double quotation marks
  • greenish-yellow when typed with double quotation marks

enter image description here

The plugin "Load QSS - UI themes" provides a way to add different user interface themes. I tried a few of the themes that come with this plugin. In the Expression Builder, they all seem to use the same color settings as the UI Theme you have set in Options.

Notes:

  • In QGIS 3, the expression builder allows you to type field names with or without double quotations. But field names with spaces must be put in double quotes. It's generally not a good idea to make a field name with spaces; use camel caps (no spaces, capitalize the first letter of each word, like this: FieldName) or substitute an underscore for the space (like this: field_name).

  • Some functions require field name input in single quotes (like this: 'fieldname'). See the Expression Builder Help section for each function.

    enter image description here

| improve this answer | |

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.