Skip to content

Instantly share code, notes, and snippets.

View pryrt's full-sized avatar

PeterCJ pryrt

  • Oregon
View GitHub Profile
@pryrt
pryrt / ColorizeHtmlCssColors.py
Last active April 19, 2021 19:42
Notepad++ PythonSript to toggle colorization of #ABCDEF HTML/CSS color codes
# -*- coding: utf-8 -*-
'''
This script searches through the entire active document for HTML/CSS colors in the form #ABCDEF (# followed by 6 hex digits), and colors them per their own value. Running the script multiple times will toggle the colorization on and off.
Each file has its own state variable, so it will track the colorization state of all your files. (It will get out of sync if you close a file when it's colorized, then later re-open that file).
If the colors are getting deleted at other times, one of your lexers or plugins might be changing the INDICATOR number 0, so you can try to set INDICATOR_ID to another integer (0..7 are for lexers, 8..31 are for the Notepad++ application itself, I cannot guarantee which will or won't be used by your setup) on the INDICATOR_ID = ... line, below
URL: https://gist.github.com/pryrt/3055e137f3cb9b67a5265125507b2eae
# -*- coding: utf-8 -*-
'''
modified from https://github.com/Ekopalypse/NppPythonScripts/blob/master/npp/EnhanceAnyLexer.py
Adds a special "regex" notation of "PCJ:CSSCOLOR" which will change the coloring rules:
if you use that "regex", it will actually match r'\#[[:xdigit:]]{6}' and grab the color from
the RGB value.
available in gist at https://gist.github.com/pryrt/5ade1a13501c4df47f2fd8c00f1c7b03
Provides additional color options and should be used in conjunction with
@pryrt
pryrt / pyscReplaceBackslashSequence.py
Created February 7, 2020 18:51
Notepad++ PythonScript: Replace Backslash Sequence
# encoding=utf-8
""" pyscReplaceBackslashSequence
When run, this script will search backwards from the current cursor position,
looking for a backslash \ . If it finds intervening whitespace (tab, space,
newline, NUL), it will abort the search. If it finds a sequence of \ to the
current cursor without whitespace interruption, it will try to interpret that
as a "shortcut sequence", and try to interpret that. It will ignore any text
after the current position, so careful placement of the cursor when running
this script will allow inserting a character in between other text
<NotepadPlus>
<UserLang name="TI-Basic" ext="TIBAS" udlVersion="2.1">
<Settings>
<Global caseIgnored="yes" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00REM 00REMARK 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>