xh/assets/themes/fruity.tmTheme
Jan Verbeek 00bc6f2238 Decode headers as latin1/UTF-8, show real reason phrase
External changes:

- We now print the actual reason phrase sent by the server instead
  of guessing it from the status code. That is, if servers reply with
  "200 Wonderful" instead of "200 OK" then we show that. This is
  especially useful for status codes that xh doesn't recognize.

- Header values are now decoded as latin1, with the UTF-8 decoding
  also shown if applicable.

- A new FAQ file with an entry that explains header value encoding.
  Header output now hyperlinks to this entry when relevant and if
  supported by the terminal.

Under the hood we now color headers manually. It's still hooked up to
the `.tmTheme` files but not to the `.sublime-syntax` file. This lets
us highlight the latin1 header values differently. In the future we
could use the same approach to optimize JSON highlighting.

I'm unsure about the position of the hyperlink. Currently it's the
text "UTF-8" in `<latin1 value> (UTF-8: <utf-8 value>)`. But that
means it's only shown if the value can be decoded as UTF-8. An
alternative is to turn the latin1 value itself into a hyperlink, but
that's confusing if the value itself is already a URL (which is a
common case for the `Location` header).

I also don't feel that our text is quite distinct enough from the
header value in the default `ansi` theme. Though the hyperlink does
help to set it apart.
2024-07-04 21:34:52 +02:00

181 lines
6.0 KiB
Plaintext

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!--
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
palette number from 00 to 0f, and AA is the special value 00 to indicate
that this encoding is being used.
-->
<key>name</key>
<string>Fruity</string>
<key>colorSpaceName</key>
<string>sRGB</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#0F000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Integers</string>
<key>scope</key>
<string>constant.numeric</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#21000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Constants</string>
<key>scope</key>
<string>constant</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CA000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Strings</string>
<key>scope</key>
<string>string.quoted, punctuation.definition.string.begin, punctuation.definition.string.end</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#20000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>comment</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#1C000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Doctype</string>
<key>scope</key>
<string>meta.tag.sgml, entity.name.tag.doctype</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#40000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Tags</string>
<key>scope</key>
<string>entity.name.tag</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CA000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Attributes</string>
<key>scope</key>
<string>entity.other.attribute-name</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#C6000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Header keys</string>
<key>scope</key>
<string>source.http http.requestheaders support.variable.http</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#C6000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Header values</string>
<key>scope</key>
<string>source.http http.requestheaders string.other.http</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#20000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>HTTP</string>
<key>scope</key>
<string>keyword.other.http</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CA000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>HTTP version</string>
<key>scope</key>
<string>constant.numeric.http</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#21000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>HTTP method</string>
<key>scope</key>
<string>keyword.control.http</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#C6000000</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>JSON keys</string>
<key>scope</key>
<string>keyword.other.name.jsonkv</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#CA000000</string>
</dict>
</dict>
<!-- FIXME: does this color fit the theme? -->
<dict>
<key>name</key>
<string>Error</string>
<key>scope</key>
<string>error</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#01000000</string>
</dict>
</dict>
</array>
</dict>
</plist>