diff --git a/python/src/com/jetbrains/python/highlighting/PyHighlighter.java b/python/src/com/jetbrains/python/highlighting/PyHighlighter.java
index 8c1d05b7a488..3ef0def6e036 100644
--- a/python/src/com/jetbrains/python/highlighting/PyHighlighter.java
+++ b/python/src/com/jetbrains/python/highlighting/PyHighlighter.java
@@ -105,7 +105,9 @@ public class PyHighlighter extends SyntaxHighlighterBase {
public static final TextAttributesKey PY_INVALID_STRING_ESCAPE = TextAttributesKey.createTextAttributesKey("PY.INVALID_STRING_ESCAPE", INVALID_STRING_ESCAPE);
- public static final TextAttributesKey PY_FSTRING_EXPRESSION_BRACES = TextAttributesKey.createTextAttributesKey("PY.FSTRING_EXPRESSION_BRACES", PY_BRACES);
+ public static final TextAttributesKey PY_FSTRING_FRAGMENT_BRACES = TextAttributesKey.createTextAttributesKey("PY.FSTRING_FRAGMENT_BRACES", VALID_STRING_ESCAPE);
+ public static final TextAttributesKey PY_FSTRING_FRAGMENT_COLON = TextAttributesKey.createTextAttributesKey("PY.FSTRING_FRAGMENT_COLON", VALID_STRING_ESCAPE);
+ public static final TextAttributesKey PY_FSTRING_FRAGMENT_TYPE_CONVERSION = TextAttributesKey.createTextAttributesKey("PY.FSTRING_FRAGMENT_TYPE_CONVERSION", VALID_STRING_ESCAPE);
/**
* The 'heavy' constructor that initializes everything. PySyntaxHighlighterFactory caches such instances per level.
@@ -129,11 +131,11 @@ public class PyHighlighter extends SyntaxHighlighterBase {
keys.put(PyTokenTypes.FSTRING_START, PY_UNICODE_STRING);
keys.put(PyTokenTypes.FSTRING_END, PY_UNICODE_STRING);
keys.put(PyTokenTypes.FSTRING_TEXT, PY_UNICODE_STRING);
- keys.put(PyTokenTypes.FSTRING_FRAGMENT_TYPE_CONVERSION, PY_UNICODE_STRING);
- keys.put(PyTokenTypes.FSTRING_FRAGMENT_FORMAT_START, PY_UNICODE_STRING);
- keys.put(PyTokenTypes.FSTRING_FRAGMENT_START, PY_FSTRING_EXPRESSION_BRACES);
- keys.put(PyTokenTypes.FSTRING_FRAGMENT_END, PY_FSTRING_EXPRESSION_BRACES);
+ keys.put(PyTokenTypes.FSTRING_FRAGMENT_TYPE_CONVERSION, PY_FSTRING_FRAGMENT_TYPE_CONVERSION);
+ keys.put(PyTokenTypes.FSTRING_FRAGMENT_FORMAT_START, PY_FSTRING_FRAGMENT_COLON);
+ keys.put(PyTokenTypes.FSTRING_FRAGMENT_START, PY_FSTRING_FRAGMENT_BRACES);
+ keys.put(PyTokenTypes.FSTRING_FRAGMENT_END, PY_FSTRING_FRAGMENT_BRACES);
keys.put(PyTokenTypes.DOCSTRING, PY_DOC_COMMENT);
diff --git a/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java b/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java
index 8dd3603b5015..17efdc1997e4 100644
--- a/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java
+++ b/python/src/com/jetbrains/python/highlighting/PythonColorsPage.java
@@ -38,7 +38,9 @@ public class PythonColorsPage implements RainbowColorSettingsPage, InspectionCol
new AttributesDescriptor("Parentheses", PyHighlighter.PY_PARENTHS),
new AttributesDescriptor("Brackets", PyHighlighter.PY_BRACKETS),
new AttributesDescriptor("Braces", PyHighlighter.PY_BRACES),
- new AttributesDescriptor("f-string expression braces", PyHighlighter.PY_FSTRING_EXPRESSION_BRACES),
+ new AttributesDescriptor("f-string expression braces", PyHighlighter.PY_FSTRING_FRAGMENT_BRACES),
+ new AttributesDescriptor("f-string type conversion", PyHighlighter.PY_FSTRING_FRAGMENT_TYPE_CONVERSION),
+ new AttributesDescriptor("f-string format specifier start", PyHighlighter.PY_FSTRING_FRAGMENT_COLON),
new AttributesDescriptor("Comma", PyHighlighter.PY_COMMA),
new AttributesDescriptor("Dot", PyHighlighter.PY_DOT),
new AttributesDescriptor("Function definition", PyHighlighter.PY_FUNC_DEFINITION),
@@ -120,7 +122,7 @@ public class PythonColorsPage implements RainbowColorSettingsPage, InspectionCol
"" +
RainbowHighlighter.generatePaletteExample("\n ") + "\n" +
" \"\"\"\n" +
- " s = (\"Test\", 2+3, {'a': 'b'}, f'{x}') # Comment\n" +
+ " s = (\"Test\", 2+3, {'a': 'b'}, f'{x!s:{\"foo\"}}') # Comment\n" +
" f(s[0].lower())\n" +
"\n" +
"class Foo:\n" +