Sphinx) sphinx-rtd-theme에서 Logo 바꾸기

2022. 2. 5. 15:59꿀팁 분석 환경 설정/파이썬 개발 팁

728x90

Sphinx에서 로그를 간단하게 바꾸는 방법을 공유한다.

 

일단 source 안에 _static에 자신이 원하는 이미지를 넣는다.

그 다음에 source/conf.py 에 아래와 같은 코드를 추가하자.

html_theme에 따라서 html_theme_options가 변경되니 주의하자.

# 터미널에서 실행
pip install sphinx-rtd-theme
# conf.py 에서 실행

html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
html_logo = "_static/whale.png"
html_theme_options = {
    "logo_only": True,
    "display_version": False,
}

 

아래의 명령어를 통해 반영할 수 있다.

cd docs
make clean # (초기화)
make html

 

그럼 로고가 잘 들어간 것을 알 수 있다.

whale png

 

 

https://readthedocs.org/projects/androidyostin/downloads/pdf/master/

 

728x90