---
title: "Export and import VS.NET's text editor's color and font settings"
url: "https://osherove.com/blog/2003/7/4/export-and-import-vsnets-text-editors-color-and-font-setting.md"
canonical: "https://osherove.com/blog/2003/7/4/export-and-import-vsnets-text-editors-color-and-font-setting.html"
published: "2003-07-04T23:20:00"
updated: "2003-07-04T23:20:00"
tags: [".Net Original"]
author: "Roy Osherove"
description: "I like customizing the way my VS.NET text editor looks and feels. I like dabbling with the colors and settings of the editor until everything is just as I like it. One caveat – If I move to a different computer – all…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Export and import VS.NET's text editor's color and font settings

By Roy Osherove July 4, 2003 In [.Net Original](https://osherove.com/blog/category/net-original)

**Historical article** · Originally published July 4, 2003; technical details may be outdated.

I like customizing the way my VS.NET text editor looks and feels. I like dabbling with the colors and settings of the editor until everything is just as I like it. One caveat – If I move to a different computer – all the settings are gone, and I could find no way of taking them with me.

So – I created this handy little macro module, which allows you to :

·         **Save** your current colors and fonts settings in a text file

·         **Load** colors and settings from a text file

Simple huh?

I’ve only tested this with vs.net 2002, so I’d like to know if it works on 2003 as well…

Here’s the code. To use it, just copy and paste it all in a new module in your vs.net macros(ALT+F11).

I'll try to turn this into an easier t use addin(will be a nice learning exercise..)

Update:

I'll have the Add-in ready by the end of the day :) it's pretty cool!

---

Imports EnvDTE

Imports System.IO

Imports System.Text

Imports System

Public Module Settings

    '-------------------------------------------------

    'saves the current color and font settings of the text editor to a named text file

    Public Sub SaveColorSettings()

        Dim sb As New StringBuilder()

        Dim clr As \[Property\]

        Dim ci As ColorableItems

        Dim sFile As String = GetFileName()

        If sFile = "" Then Exit Sub

clr = \_

DTE.Properties("FontsAndColors","TextEditor").Item(\_

"FontsAndColorsItems")

        For Each ci In clr.Object

            sb.Append(ci.Name & vbTab & \_

ci.Foreground.ToString() & vbTab & \_

ci.Bold.ToString() & vbTab & \_

ci.Background.ToString() & vbNewLine)

        Next

        Dim write As TextWriter = File.CreateText(sFile)

        write.Write(sb.ToString())

        write.Close()

        MsgBox(sFile & " created!", MsgBoxStyle.Information)

    End Sub

    '--------------------------------------------

    'Loads color and font settings of the

‘text editor from a named text file

    Public Sub LoadColorSettings()

        Dim sFile As String = GetFileName()

        If sFile = "" Then Exit Sub

        Dim reader As TextReader = File.OpenText(sFile)

        Dim sLine As String

        Try

            Do

                sLine = reader.ReadLine()

                ParseLine(sLine)

            Loop While sLine.Length > 0

        Catch e As Exception

        End Try

        MsgBox("settings loaded successfully!")

    End Sub

    '---------------------------------------------------

    Private Function DefaultSettingsFileName() As String

        Return Path.Combine(Environment.CurrentDirectory, "EditorSettings.txt")

    End Function

    '------------------------------------------------------

    Private Sub ParseLine(ByVal sLine As String)

        Dim clr As \[Property\]

        Dim ci As ColorableItems

        Dim arr As String()

        Try

            arr = Split(sLine, vbTab)

            clr = DTE.Properties("FontsAndColors", "TextEditor").Item("FontsAndColorsItems")

            ci = clr.Object(arr(0))

            ci.Foreground = UInt32.Parse(arr(1).ToString())

            ci.Bold = Boolean.Parse(arr(2).ToString())

            ci.Background = UInt32.Parse(arr(3).ToString())

        Catch e As Exception

        End Try

    End Sub

    '------------------------------------------------------

    Private Function GetFileName() As String

        Dim sFile As String = InputBox( \_

"Enter the file name to create/load from", \_

"Settings file name", DefaultSettingsFileName())

        Return sFile

    End Function

    '-------------------------------------------------

End Module

## More in .Net Original

[All posts in .Net Original](https://osherove.com/blog/category/net-original)

- Jul 5, 2003

    ### [Settings Add-in ver. 1.0 released on GotDotNet](https://osherove.com/blog/2003/7/5/settings-add-in-ver-10-released-on-gotdotnet.html)

- Jul 5, 2003

    ### [What's missing in today's hottest languages?](https://osherove.com/blog/2003/7/5/whats-missing-in-todays-hottest-languages.html)

- Jul 3, 2003

    ### [A much needed SchemaHelper class](https://osherove.com/blog/2003/7/3/a-much-needed-schemahelper-class-1.html)

- Jul 1, 2003

    ### [Why I write in Both C# and VB.NET](https://osherove.com/blog/2003/7/1/why-i-write-in-both-c-and-vbnet.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
