A community-maintained Python framework for creating mathematical animations.
Some updates on making it comaptible with manim.cfg ✌️
Syrus Dark51b4079717d2
diff --git a/example_scenes/manim.cfg b/example_scenes/manim.cfgnew file mode 100644index 000000000..dffdaea37--- /dev/null+++ b/example_scenes/manim.cfg@@ -0,0 +1,12 @@+[log.color]+logging.keyword = magenta+logging.level.notset = dim+logging.level.debug = yellow+logging.level.info = dim purple+logging.level.warning = dim red+logging.level.error = red+logging.level.critical = red+log.level =+log.time = dim yellow+log.message = green+log.path = dim blue\ No newline at end of filediff --git a/example_scenes/rich.cfg b/example_scenes/rich.cfgdeleted file mode 100644index 9bbb2c046..000000000--- a/example_scenes/rich.cfg+++ /dev/null@@ -1,13 +0,0 @@-{- "logging.keyword": "bold yellow",- "logging.level.notset": "dim",- "logging.level.debug": "green",- "logging.level.info": "blue",- "logging.level.warning": "red",- "logging.level.error": "red bold",- "logging.level.critical": "red bold reverse",- "log.level": "",- "log.time": "cyan dim",- "log.message": "",- "log.path": "dim"-}\ No newline at end of filediff --git a/manim/logger/__main__.py b/manim/logger/__main__.pyindex f1d1fcf38..35a5b4b9f 100644--- a/manim/logger/__main__.py+++ b/manim/logger/__main__.py@@ -1,10 +1,11 @@from rich.console import Consolefrom rich.progress import track-import json+import configparserif __name__=="__main__":console = Console()+ config = configparser.ConfigParser()default={"logging.keyword":"bold yellow","logging.level.notset":"dim","logging.level.debug":"green",@@ -25,7 +26,8 @@ if __name__=="__main__":temp=input()if temp:default[key]=temp+ config['log.color']=defaultfor n in track(range(100), description="Converting to JSON"):- with open("rich.cfg","w") as fp:- json.dump(default,fp,indent=4)- console.print("A file called [yellow]rich.cfg[/yellow] is created. To save your theme please save that file and each time \nplace it in you current working directory(The directory where you execute manim command) for the your theme to be displayed.")\ No newline at end of file+ with open("manim.cfg","w") as fp:+ config.write(fp)+ console.print("A file called [yellow]manim.cfg[/yellow] is created. To save your theme please save that file and each time \nplace it in you current working directory(The directory where you execute manim command) for the your theme to be displayed.")\ No newline at end of filediff --git a/manim/logger/console.py b/manim/logger/console.pyindex 3508e923e..7dc20d9a9 100644--- a/manim/logger/console.py+++ b/manim/logger/console.py@@ -1,16 +1,16 @@-import json+import configparserfrom rich.console import Consolefrom rich.theme import Themedef parseTheme(fp):- with open(fp,'r') as f:- content=f.read()- theme=json.loads(content)+ config = configparser.ConfigParser()+ config.read(fp)+ theme=dict(config['log.color'])customTheme=Theme(theme)return customThemetry:- customTheme = parseTheme("rich.cfg")+ customTheme = parseTheme("manim.cfg")console = Console(theme=customTheme)-except:+except KeyError:console = Console()