Last active
September 29, 2021 19:11
-
-
Save Soulwest/fcbe82f06608354dcb41a69b88dd50bd to your computer and use it in GitHub Desktop.
Shadow parser Praser https://html-css-js.com/css/generator/text-shadow/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import sys | |
import re | |
logging.basicConfig(level=logging.DEBUG) | |
logging.info('Convert shadow to convertful config format') | |
print("Enter rules: ") | |
rule = '\n'.join(iter(input, '')) | |
logging.info('Rules: '+rule) | |
lines = rule.split("\n") | |
for line in lines: | |
# Clean and format input | |
line = re.sub(r'VM\d+:\d+ ', '', line) | |
args = line.replace(', ', ',').split() | |
if not args: | |
logging.warning('Empty shadow') | |
sys.exit(1) | |
for i, arg in enumerate(args): | |
args[i] = arg.replace('px', '') | |
print('''[ | |
'dx' => {1}, | |
'dy' => {2}, | |
'blur' => {3}, | |
'color' => '{0}', | |
],'''.format(*args)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('h1').each(function(k, v){ | |
var shadows = getComputedStyle(v).textShadow; | |
console.log(shadows.replaceAll(', rgb', ",\nrgb")) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment