The dosv plugin above uses scintilla and supports a colour scheme system similar to what notepad++ uses.
Because of this with a little bit of tweaking we can take the original dosv.config.xml merge it with a notepad++ theme and load it in to DOpus.
If you would like to use any of the styles in the table do the flowing:
- Download the dosv generated file
- rename the file to dosv.config.xml
- copy the file to %APPDATA%\GPSoftware\Directory Opus\ConfigFiles\Plugins
Sample themes
These colour schemes came from this site, it has a list of some nice Notepad++ colour schemes. I have converted them to work with the dosv DOpus addin. Full credit goes to the original creator of the colour scheme and Tim Trott for the page listing them
Converting from Notepad++ style to dosv
A powershell script was used to to generate the dosv config files in the above table from the original notepad++ styles.
If you have another style form notepad++ you want to use, the script should work. You will need to pass in the notpad ++ style and the original dosvconfig file.
function Format-Xml {
<#
.SYNOPSIS
Format the incoming object as the text of an XML document.
#>
param(
## Text of an XML document.
[Parameter(ValueFromPipeline = $true)]
[string[]]$Text
)
begin {
$data = New-Object System.Collections.ArrayList
}
process {
[void] $data.Add($Text -join "`n")
}
end {
$doc=New-Object System.Xml.XmlDataDocument
$doc.LoadXml($data -join "`n")
$sw=New-Object System.Io.Stringwriter
$writer=New-Object System.Xml.XmlTextWriter($sw)
$writer.Formatting = [System.Xml.Formatting]::Indented
$doc.WriteContentTo($writer)
$sw.ToString()
}
}
function Add-WordStyleElement {
param(
[string[]]$Text
)
}
function Merge-ScintillaConfigElement {
<#
.SYNOPSIS
Converts a scintilla to the DOpus DOSV format
#>
param(
[System.Xml.XmlElement]$DosvElement,
[System.Xml.XmlElement]$ScintillaElement
)
$dosv = $DosvElement.OwnerDocument
#$referenceObject = @($DosElement.WordStyles.WordStyle | Select-Object -ExpandProperty name)
$dosvWordStyles = $DosvElement.SelectSingleNode("./WordStyles")
$referenceObject = @($dosvWordStyles.ChildNodes | Select-Object -ExpandProperty name)
$differenceObject = @($ScintillaElement.ChildNodes | Select-Object -ExpandProperty name)
$delta = @(Compare-Object $referenceObject $differenceObject -IncludeEqual)
$delta | ForEach-Object {
$deltaItem = $_
write-host "'$($deltaItem.SideIndicator)' WordStyles '$($deltaItem.InputObject)'"
switch ($deltaItem.SideIndicator)
{
'==' {
#update
$dosvItem = $DosvElement.WordStyles.selectSingleNode("./WordStyle[@name='$($deltaItem.InputObject)']")
$scintillaItem = $ScintillaElement.selectSingleNode("./WordsStyle[@name='$($deltaItem.InputObject)']")
$dosvItem.SetAttribute('fgColor', $scintillaItem.fgColor) | out-null
$dosvItem.SetAttribute('bgColor', $scintillaItem.bgColor) | out-null
$dosvItem.SetAttribute('fontName', $scintillaItem.fontName) | out-null
$dosvItem.SetAttribute('fontStyle', $scintillaItem.fontStyle) | out-null
$dosvItem.SetAttribute('fontSize', $scintillaItem.fontSize) | out-null
$dosvItem.SetAttribute('keywordClass', $scintillaItem.keywordClass) | out-null
}
'=>' {
#add
$scintillaItem = $ScintillaElement.selectSingleNode("./WordsStyle[@name='$($deltaItem.InputObject)']")
[System.Xml.XmlElement]$xmlNode = $dosv.CreateElement('WordStyle')
$xmlNode.SetAttribute('bgColor',$($scintillaItem.bgColor)) | out-null
$xmlNode.SetAttribute('eolFill','') | out-null
$xmlNode.SetAttribute('fgColor',$($scintillaItem.fgColor)) | out-null
$xmlNode.SetAttribute('fontName',$($scintillaItem.fontName)) | out-null
$xmlNode.SetAttribute('fontSize',$($scintillaItem.fontSize))
$xmlNode.SetAttribute('fontStyle',$($scintillaItem.fontStyle)) | out-null
$xmlNode.SetAttribute('name',$($scintillaItem.name)) | out-null
$xmlNode.SetAttribute('styleID',$($scintillaItem.styleID)) | out-null
$xmlNode.SetAttribute('keywordClass',$($scintillaItem.keywordClass)) | out-null
$dosvWordStyles.AppendChild($xmlNode);
}
'<=' {
#ignore
}
}
write-host "'$($deltaItem.SideIndicator)' WordStyles '$($deltaItem.InputObject)' - done"
}
return $DosvElement
}
function Merge-ScintillaGlobalElement {
<#
.SYNOPSIS
Converts a scintilla to the DOpus DOSV format
#>
param(
[System.Xml.XmlElement]$DosvElement,
[System.Xml.XmlElement]$ScintillaGlobalElement
)
$dosv = $DosvElement.OwnerDocument
#$referenceObject = @($DosElement.WordStyles.WordStyle | Select-Object -ExpandProperty name)
$dosvWordStyles = $DosvElement.SelectSingleNode("./WordStyles")
$dosvWordStyles.OuterXml | Out-Host
$ScintillaGlobalElement.OuterXml | Out-Host
$referenceObject = @($dosvWordStyles.ChildNodes | Select-Object -ExpandProperty name)
if($DosvElement.name -eq "default")
{
$differenceObject = @($ScintillaGlobalElement.ChildNodes | Select-Object -ExpandProperty name)
}
else
{
$differenceObject = @($ScintillaGlobalElement.ChildNodes | Where-Object { $_.name -eq 'Line number margin'} | Select-Object -ExpandProperty name)
}
$delta = @(Compare-Object $referenceObject $differenceObject -IncludeEqual)
$delta | ForEach-Object {
$deltaItem = $_
write-host "'$($deltaItem.SideIndicator)' GlobalStyles '$($deltaItem.InputObject)'"
switch ($deltaItem.SideIndicator)
{
'==' {
#update
}
'=>' {
#add
$scintillaItem = $ScintillaGlobalElement.selectSingleNode("./WidgetStyle[@name='$($deltaItem.InputObject)']")
[System.Xml.XmlElement]$xmlNode = $dosv.CreateElement('WordStyle')
$xmlNode.SetAttribute('bgColor',$scintillaItem.bgColor)
$xmlNode.SetAttribute('eolFill','')
$xmlNode.SetAttribute('fgColor',$scintillaItem.fgColor)
$xmlNode.SetAttribute('fontName',$scintillaItem.fontName)
$xmlNode.SetAttribute('fontSize',$scintillaItem.fontSize)
$xmlNode.SetAttribute('fontStyle',$scintillaItem.fontStyle)
$xmlNode.SetAttribute('name',$scintillaItem.name)
$xmlNode.SetAttribute('styleID',$scintillaItem.styleID)
$xmlNode.SetAttribute('keywordClass',$scintillaItem.keywordClass)
$dosvWordStyles.AppendChild($xmlNode)
}
'<=' {
#ignore
}
}
write-host "'$($deltaItem.SideIndicator)' WordStyles '$($deltaItem.InputObject)' - done"
}
return $DosvElement
}
function Convert-ScintillaConfig {
<#
.SYNOPSIS
Converts a scintilla to the DOpus DOSV format
#>
param(
[string[]]$ScintillaConfigPath,
[string[]]$DosvConfigPath
)
$lexerCounter = 0
[xml]$scintillaConfig = Get-Content -Path $ScintillaConfigPath
[xml]$dosvConfig = Get-Content -Path $DosvConfigPath
$scintillaConfig.SelectNodes("//comment()") | ForEach-Object { $_.ParentNode.RemoveChild($_); } | out-null
$dosvConfig.SelectNodes("//comment()") | ForEach-Object { $_.ParentNode.RemoveChild($_); } | out-null
$scintillaGlobalStyles = $scintillaConfig.NotepadPlus.GlobalStyles
$referenceObject = @($dosvConfig.Config.Styles.Style | Select-Object -ExpandProperty name)
$differenceObject = @($scintillaConfig.NotepadPlus.LexerStyles.LexerType | Select-Object -ExpandProperty name)
$delta = @(Compare-Object $referenceObject $differenceObject -IncludeEqual)
$delta | ForEach-Object {
$deltaItem = $_
write-host "'$($deltaItem.SideIndicator)' Style '$($deltaItem.InputObject)'"
switch ( $deltaItem.SideIndicator)
{
'==' {
#update
$dosvItem = $dosvConfig.Config.Styles.selectSingleNode("./Style[@name='$($deltaItem.InputObject)']")
$scintillaItem = $scintillaConfig.NotepadPlus.LexerStyles.selectSingleNode("./LexerType[@name='$($deltaItem.InputObject)']")
$dosvItem = Merge-ScintillaConfigElement $dosvItem $scintillaItem
}
'=>' {
#add
#$result = 'Monday'
}
'<=' {
#ignore
#$result = 'Tuesday'
}
}
write-host "'$($deltaItem.SideIndicator)' Style '$($deltaItem.InputObject)' - Done"
$dosvItem = $dosvConfig.Config.Styles.selectSingleNode("./Style[@name='$($deltaItem.InputObject)']")
if( $dosvItem -ne $null)
{
$dosvItem = Merge-ScintillaGlobalElement $dosvItem $scintillaGlobalStyles
write-host "'$($deltaItem.SideIndicator)' Style Defaults '$($deltaItem.InputObject)' - Done"
}
}
write-host "Done All"
return $dosvConfig
}
$originalDosvConfigPath = 'c:\dosv.config.original.xml'
$notepadConfigPath = 'C:\yourstyle.xml'
$outputpath = 'c:\dosv.config.xml'
$result = Convert-ScintillaConfig $notepadConfigPath $originalDosvConfigPath
$result.OuterXml | set-content -LiteralPath $outputpath