简体   繁体   English

Visual Studio标准样式为CSS

[英]Visual Studio Standard Style as CSS

I'm searching for the correct style to configure CopySourceAsHtml to change my Selenitic style to default Visual Studio style when I copy and paste it to eg an e-mail. 我正在寻找正确的样式来配置CopySourceAsHtml,以便在将其复制并粘贴到例如电子邮件时将Selenitic样式更改为默认的Visual Studio样式。 Does anybody know what CSS style(s) I need to use to set it up correctly? 有人知道我需要使用哪种CSS样式来正确设置它吗?

When I copy & paste source code an e-mail I get a dark background. 当我复制并粘贴源代码的电子邮件时,背景变得很暗。 If I set it to white it will show all text in light colours which are hard to read. 如果我将其设置为白色,它将以难以阅读的浅色显示所有文本。 So I need to change the complete style. 因此,我需要更改完整的样式。

How does your plugin expect the CSS to look like? 您的插件对CSS的期望如何? If you open the theme I referred to in the comments above in a text editor you'll see a lot of lines like this: 如果您在文本编辑器中打开我在上面的注释中提到的主题,则会看到很多类似以下内容的行:

<Item Name="outlining.collapsehintadornment" Foreground="0x00E8DDD7" Background="0x00FAF7F6" BoldFont="No"/>

Now since I don't know how exactly your plugin is expecting the CSS I will go ahead and give an example of what this might look like in CSS: 现在,因为我不知道你的插件是如何准确地期待CSS我会继续前进,让公众知道这可能看起来像在CSS的例子:

.outlining-collapsehintadornment
{
    color: #D7DDE8;
    background-color: #F6F7FA;
}

Or: 要么:

<Item Name="String" Foreground="0x001515A3" Background="0x02000000" BoldFont="No"/>

Becomes 成为

.String
{
    color: #A31515; 
    background-color: #000000;
}

How did I get this? 我是怎么得到的?

Visual Studio settings file save color codes as "code hex" values. Visual Studio设置文件将颜色代码另存为“十六进制代码”值。 And they use BGR instead of RGB. 他们使用BGR代替RGB。 This means that you can convert this VS color hexes very simple to HTML color hexes. 这意味着您可以将VS颜色十六进制非常简单地转换为HTML颜色十六进制。 And since HTML uses RGB don't forget to invert the code. 而且由于HTML使用RGB,所以请不要忘记反转代码。 So for example: 0x00E8DDD7. 因此,例如:0x00E8DDD7。 Replace the 0x00 (sometimes this may be 0x02) with a #. 将0x00(有时可能是0x02)替换为#。 And then swap the first 2 and the last 2 characters (BGR to RGB). 然后交换前2个字符和后2个字符(从BGR到RGB)。 So you get #E8DDD7 = #D7DDE8. 这样就得到了#E8DDD7 =#D7DDE8。 And of course "Foreground" is text-color and "Background" is background-color...If your plugin supports it you might even consider to write font-size: bold if you see BoldFont="Yes" in your XML. 当然,“前景”是文本颜色,“背景”是背景颜色...如果您的插件支持,您甚至可以考虑编写font-size: bold如果在XML中看到BoldFont="Yes" ,则font-size: bold

Summarized: Open the VSSettings file I referred to in my comment above in a texteditor. 总结:在文本编辑器中打开我在上面的注释中提到的VSSettings文件。 Then convert everything to CSS. 然后将所有内容转换为CSS。 Write a simple program to do this, or do it by hand, whatever you prefer. 编写一个简单的程序即可执行此操作,也可以手动执行此操作。 Just remember that this is just an example of what it might look like. 请记住,这只是其外观的一个示例。 I don't know what "CopySourceAsHtml" is expecting your CSS to look like. 我不知道“ CopySourceAsHtml”期望您的CSS看起来像什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM