mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 13:29:47 +00:00
Add optional dark theme for the docs
This commit is contained in:
@@ -114,7 +114,9 @@ def _generate_index(folder, original_paths, root):
|
||||
filename = os.path.join(folder, 'index.html')
|
||||
with DocsWriter(filename, type_to_path=_get_path_for_type) as docs:
|
||||
# Title should be the current folder name
|
||||
docs.write_head(folder.title(), relative_css_path=paths['css'])
|
||||
docs.write_head(folder.title(),
|
||||
relative_css_path=paths['css'],
|
||||
default_css=original_paths['default_css'])
|
||||
|
||||
docs.set_menu_separator(paths['arrow'])
|
||||
_build_menu(docs, filename, root,
|
||||
@@ -206,7 +208,8 @@ def _write_html_pages(tlobjects, errors, layer, input_res, output_dir):
|
||||
# * Generating the types documentation, showing available constructors.
|
||||
# TODO Tried using 'defaultdict(list)' with strange results, make it work.
|
||||
original_paths = {
|
||||
'css': 'css/docs.css',
|
||||
'css': 'css',
|
||||
'default_css': 'docs.light.css',
|
||||
'arrow': 'img/arrow.svg',
|
||||
'search.js': 'js/search.js',
|
||||
'404': '404.html',
|
||||
@@ -251,7 +254,8 @@ def _write_html_pages(tlobjects, errors, layer, input_res, output_dir):
|
||||
|
||||
with DocsWriter(filename, type_to_path=path_for_type) as docs:
|
||||
docs.write_head(title=tlobject.class_name,
|
||||
relative_css_path=paths['css'])
|
||||
relative_css_path=paths['css'],
|
||||
default_css=original_paths['default_css'])
|
||||
|
||||
# Create the menu (path to the current TLObject)
|
||||
docs.set_menu_separator(paths['arrow'])
|
||||
@@ -392,9 +396,9 @@ def _write_html_pages(tlobjects, errors, layer, input_res, output_dir):
|
||||
for k, v in original_paths.items()}
|
||||
|
||||
with DocsWriter(filename, type_to_path=path_for_type) as docs:
|
||||
docs.write_head(
|
||||
title=snake_to_camel_case(name),
|
||||
relative_css_path=paths['css'])
|
||||
docs.write_head(title=snake_to_camel_case(name),
|
||||
relative_css_path=paths['css'],
|
||||
default_css=original_paths['default_css'])
|
||||
|
||||
docs.set_menu_separator(paths['arrow'])
|
||||
_build_menu(docs, filename, output_dir,
|
||||
@@ -570,7 +574,8 @@ def _write_html_pages(tlobjects, errors, layer, input_res, output_dir):
|
||||
|
||||
|
||||
def _copy_resources(res_dir, out_dir):
|
||||
for dirname, files in [('css', ['docs.css']), ('img', ['arrow.svg'])]:
|
||||
for dirname, files in [('css', ['docs.light.css', 'docs.dark.css']),
|
||||
('img', ['arrow.svg'])]:
|
||||
dirpath = os.path.join(out_dir, dirname)
|
||||
os.makedirs(dirpath, exist_ok=True)
|
||||
for file in files:
|
||||
|
Reference in New Issue
Block a user