Skip to content

Instantly share code, notes, and snippets.

@bamboo
Last active January 4, 2016 10:18
Show Gist options
  • Save bamboo/8607456 to your computer and use it in GitHub Desktop.
Save bamboo/8607456 to your computer and use it in GitHub Desktop.
API based way of extending Livity color schemes. Save this file to a Editor/ folder inside your project and after refreshing the new color schemes should be available in the command palette and preferences dialog. Change and refresh to your liking. (It should be simpler I know, please bear with me!!! :))
using Livity.Collections;
using Livity.Composition;
using Livity.Text.Logic;
using Livity.Text.UI.Engine;
using Livity.Text.UI.Engine.Internal;
using UnityEngine;
namespace Livity.Mine
{
[Export(typeof(IColorSchemeProvider))]
class MyColorSchemes : IColorSchemeProvider
{
public IImmutableList<IColorScheme> ColorSchemes
{
get { return ImmutableList.Of(MyDarkColorScheme(), MyLightColorScheme()); }
}
IColorScheme MyDarkColorScheme()
{
return new ColorScheme("My Dark")
{
Background = C(41, 41, 41),
Selection = C(61, 96, 145),
LineNumber = C(0x80, 0xb0, 0xb0),
Caret = C(234, 234, 226),
Classifications =
{
{Classifications.Keyword, Colors.LightBlue},
{Classifications.Identifier, Colors.White},
{Classifications.Name, C(165, 225, 46)},
{Classifications.WhiteSpace, Colors.DarkYellow},
{Classifications.Text, Colors.White},
{Classifications.Operator, Colors.Pink},
{Classifications.Punctuation, Colors.Offwhite},
{Classifications.String, Colors.LightBrown},
{Classifications.Comment, Colors.Grey},
{Classifications.Literal, Colors.Green},
{
Classifications.Occurrence,
new ClassificationFormat
{
BackgroundColor = C(128, 128, 128),
BorderColor = Color.white
}
},
{
Classifications.ActiveOccurrence,
new ClassificationFormat
{
BackgroundColor = C(114, 114, 114),
BorderColor = Color.white,
IsBold = true
}
}
}
};
}
IColorScheme MyLightColorScheme()
{
return new ColorScheme("My Light")
{
Background = C(216, 216, 216),
Selection = C(190, 190, 190),
LineNumber = C(0x80, 0xb0, 0xb0),
Classifications =
{
{Classifications.Keyword, C(0, 0, 160)},
{Classifications.Identifier, C(20, 20, 20)},
{Classifications.WhiteSpace, C(130, 148, 150)},
{Classifications.Text, C(20, 20, 20)},
{Classifications.Operator, C(0x80, 0, 0x80)},
{Classifications.Punctuation, C(0x80, 0x80, 0x80)},
{Classifications.String, C(0x80, 0x80, 0)},
{Classifications.Comment, C(0, 0x80, 0)},
{Classifications.Literal, C(0, 0x80, 0)},
{
Classifications.Occurrence,
new ClassificationFormat {BackgroundColor = Colors.LightBrown}
},
{
Classifications.ActiveOccurrence,
new ClassificationFormat {BackgroundColor = Colors.LightBrown, IsBold = true}
}
}
};
}
[Import]
public IStandardClassifications Classifications
{
get; set;
}
static Color C(int r, int g, int b)
{
return new Color(r / 255f, g / 255f, b / 255f, 1f);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment