Commit Graph

32 Commits

Author SHA1 Message Date
Allan Odgaard
efe617b4bc Update testing system for theme framework 2013-07-26 13:53:58 +02:00
Allan Odgaard
4bae908d49 Move CGColorRef helper functions
These only have one user, so let’s make them private helper functions instead.
2013-02-20 12:54:26 +01:00
Allan Odgaard
d70ccc7cdf Allow theme colors to use the sRGB color profile
This is enabled by adding the following to your theme:

    colorSpaceName = sRGB;

The default color space used for themes is “Apple Generic RGB” which is a bad choice for interoperability with other software (e.g. exporting a theme to CSS, creating theme colors in Photoshop, and similar).

Related to issue #768.
2013-02-18 15:38:27 +01:00
Allan Odgaard
08534e737f Change gutter colors to CGColorRef 2013-02-18 15:38:27 +01:00
Allan Odgaard
deeff330ee Change cf::color_t → CGColorRef
This change is required to introduce support for different color profiles.
2013-02-18 15:38:27 +01:00
Allan Odgaard
b139ac5097 Change push_back → emplace_back (C++11)
This is mainly motivated by readability, so I only did a few select replacements.
2013-02-08 11:20:35 +01:00
Joachim Mårtensson
8de62bbc85 Don't mutate shared themes 2013-02-04 20:44:21 +01:00
Allan Odgaard
951fd53b30 Construct default theme from a dummy bundle item 2013-01-29 21:41:17 +01:00
Allan Odgaard
c8ab123aaf Move font name/size to theme_t
Since styles_for_scope effectively ignore the font parameters (and instead return styles based on the font parameters used when the cache entry was created) it is a better design to have theme_t own the font. This way, changing it can do the proper cache invalidation.

A minor downside is that we can now change the font of the theme without also changing the layout’s font, which wouldn’t cause proper layout invalidation — since layout_t owns theme_t though, users of a layout should always change font via layout_t (which will then change it in the theme).

Also, themes cannot be shared between views that wish to use different font settings.
2013-01-23 09:33:29 +01:00
Allan Odgaard
30c60ddc34 Accept scope_t instead of context_t
Since styles are applied to the actual content, we only have a single scope, not a left/right scope.
2013-01-23 08:19:39 +01:00
Joachim Mårtensson
2b51ca93bd Don’t use font name / size as key values in style cache
Font name and font size was being used in the cache key as a way to avoid having to do cache invalidation. This comes at a price of a 3X slow down. Instead clear the cache when font size/name changes. Excessive font name/size switching should be deterred IMO, why not with slowdowns? so no real downside. This does not affect themes setting font name/size, as they are handled by another mechanism.
2013-01-23 08:04:17 +01:00
Robert Hencke
7a9ff232fe Apply default gutter theme when no theme is active
Previously, if no themes were active, the gutter colors would
not be set.  This would, effectively, give you random gutter colors
on TextMate startup. (or, sometimes, a completely transparent gutter).
2012-10-24 21:07:21 +07:00
Allan Odgaard
b88ba4ff23 Extend theme_t’s public API 2012-09-10 22:47:57 +02:00
Allan Odgaard
7a67248dec No longer necessary to set all gutter colors
Previously all the colors were calculated so setting e.g. the icon color made it sort of necessary to also set the iconHover and iconPressed color.

Now the default icon hover and pressed colors are a potential user supplied icon color. Likewise, the default icon color is a potential user supplied foreground color, etc.
2012-09-08 01:02:47 +02:00
Allan Odgaard
aba449d171 Move gutter styles to own settings dictionary
This removes all the blending, the need to provide a scope selector to obtain them, and no longer taxes the general syntax highlight (by no longer having to carry around a dozen gutter styles per scope).
2012-09-08 00:40:08 +02:00
Dennis Vennink
f2f14dd48a Extended gutter theming support
The following four new keys have been added:

 - gutterIconsHover
 - gutterIconsPressed
 - gutterSelectionIconsHover
 - gutterSelectionIconsPressed
2012-09-07 21:21:35 +02:00
Allan Odgaard
8a7710e93e Use std::tuple instead of boost::tuple 2012-08-30 23:04:20 +02:00
Jacob Bandes-Storch
e3aa997b06 Use libc++: replace std::tr1 with std 2012-08-28 13:30:20 +02:00
Allan Odgaard
fc13d2021d Tweak gutter colors
Use the text foreground color for icons when the theme doesn’t provide a color and introduce ‘gutterSelectionIcons’ for the color of selected icons (defaults to selected foreground color).

Also changed the gutter selection border color to match the divider color (when it isn’t specified by the theme).
2012-08-26 18:52:25 +02:00
Dennis Vennink
6e02f55fff Add gutterSelectionBorder and gutterIcons theme keys 2012-08-26 18:26:34 +02:00
Allan Odgaard
846357c52f Code aesthetics 2012-08-25 21:04:22 +02:00
Allan Odgaard
8e1aa09d17 Colors are now transparent against background
Previously if the color for X (where X is e.g. foreground or invisibles) had an alpha value other than 1.0 (fully opaque) it would be blended against the less specifically scoped color for X rather than the background.

There was no real logic behind the previous design other than to treat all color blending the same and it would cause a problem for 1.x themes using transparency for selection or invisible characters.

Closes issue #285.
2012-08-25 20:56:36 +02:00
David Howden
b8b25a46c8 Extend gutter theming to selection foreground
New theme setting: gutterSelectionForeground
2012-08-23 14:42:11 +02:00
Joachim Mårtensson
ab310cbdab Use cf::color_t RGBA constructor when converting color_info_t 2012-08-22 17:06:56 +02:00
David Howden
f2dd19f2a3 Extend support for theming the gutter
New theme setting: gutterSelectionBackground
2012-08-22 15:10:21 +02:00
Jacob Bandes-Storch
8eb3dd0379 Calculate default gutter colors based on theme 2012-08-20 19:10:39 +02:00
Jacob Bandes-Storch
1c83eaa389 Add support for theming the gutter
Theme setting keys gutterForeground, gutterBackground, and gutterDivider
2012-08-20 19:01:56 +02:00
Allan Odgaard
699969695c Restructure code 2012-08-18 22:39:01 +02:00
Allan Odgaard
9d99e1c617 fixup! Represent font size using a CGFloat 2012-08-18 22:27:06 +02:00
Joachim Mårtensson
18eecca2ab Represent font size using a CGFloat
This applies to scoped font size settings and should be faster than the previous std::string based approach.
2012-08-18 16:28:47 +02:00
Joachim Mårtensson
ece7758e09 Represent theme colors as 4 doubles (RGBA)
This should be faster (and probably more precise) than the previous std::string based color manipulations.
2012-08-18 16:28:47 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00