aboutsummaryrefslogtreecommitdiffhomepage
path: root/highlight.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-11 17:07:56 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-11 17:07:56 -0800
commitd66700a0e4d20a9193ea83490781c0858d98c3f6 (patch)
tree85ac2ea2e5cedda5d99cbbf3eba95eb07de4a0cf /highlight.cpp
parentb59a22bef03b7b7922687cb4f1e6acb8a2709218 (diff)
Color work
Diffstat (limited to 'highlight.cpp')
-rw-r--r--highlight.cpp49
1 files changed, 48 insertions, 1 deletions
diff --git a/highlight.cpp b/highlight.cpp
index 84f72fd7..6c4f38be 100644
--- a/highlight.cpp
+++ b/highlight.cpp
@@ -166,6 +166,54 @@ static bool is_potential_path( const wcstring &cpath )
}
+rgb_color_t highlight_get_rgb_color( int highlight, bool is_background )
+{
+ size_t i;
+ int idx=0;
+ rgb_color_t result;
+
+ if( highlight < 0 )
+ return rgb_color_t::normal();
+ if( highlight > (1<<VAR_COUNT) )
+ return rgb_color_t::normal();
+ for( i=0; i<VAR_COUNT; i++ )
+ {
+ if( highlight & (1<<i ))
+ {
+ idx = i;
+ break;
+ }
+ }
+
+ env_var_t val_wstr = env_get_string( highlight_var[idx]);
+
+// debug( 1, L"%d -> %d -> %ls", highlight, idx, val );
+
+ if (val_wstr.missing())
+ val_wstr = env_get_string( highlight_var[0]);
+
+ if( ! val_wstr.missing() )
+ result = parse_color( val_wstr, is_background );
+
+ if( highlight & HIGHLIGHT_VALID_PATH )
+ {
+ env_var_t val2_wstr = env_get_string( L"fish_color_valid_path" );
+ const wcstring val2 = val2_wstr.missing() ? L"" : val2_wstr.c_str();
+
+ rgb_color_t result2 = parse_color( val2, is_background );
+ if( result == rgb_color_t::normal() )
+ result = result2;
+ else
+ {
+ if( result2.is_bold() )
+ result.set_bold(true);
+ if( result2.is_underline() )
+ result.set_underline(true);
+ }
+
+ }
+ return result;
+}
int highlight_get_color( int highlight, bool is_background )
@@ -215,7 +263,6 @@ int highlight_get_color( int highlight, bool is_background )
}
return result;
-
}
/**