![更改章节和部分的颜色](https://linux22.com/image/458377/%E6%9B%B4%E6%94%B9%E7%AB%A0%E8%8A%82%E5%92%8C%E9%83%A8%E5%88%86%E7%9A%84%E9%A2%9C%E8%89%B2.png)
我一直在努力改变章节名称和部分名称的颜色。
这是我的作品
\documentclass[a4paper,12pt, twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[english, vietnamese]{babel}
\usepackage{wrapfig}
\usepackage[dvipsnames]{xcolor}
\usepackage[top=2cm, bottom=2cm, left=2cm, right=2cm]{geometry}
\usepackage{color,graphicx,multicol,hyperref,geometry,graphicx,amsmath,tikz,amssymb,pgf,tkz-tab,amsfonts,amsthm,array,fancyhdr}
\usepackage{lipsum}
\usepackage{amsxtra, latexsym, amscd, enumerate, ifthen, amstext}
\usepackage{array, tabularx, longtable}
\usepackage{mathrsfs}
\usepackage[all]{xy}
\usepackage{subcaption}
\usepackage{csquotes}
\usepackage{textcmds}
\DeclareRobustCommand{\divby}{\mathrel{\vbox{\baselineskip.65ex\lineskiplimit0pt\hbox{.}\hbox{.}\hbox{.}}}}
\DeclareGraphicsExtensions{.pdf,.jpg,.png,.bmp}
\let\mod=\undefined
\let\top=\undefined
\DeclareMathOperator{\im}{Im}
\DeclareMathOperator{\Ker}{Ker}
\DeclareMathOperator{\rk}{rank}
\newtheorem{defi}{Definition}[section]
\newtheorem{theo}[defi]{Theorem}
\newtheorem{cor}[defi]{Corollary}
\newtheorem{lem}{Lemma}[section]
\newtheorem{prop}[defi]{Proposition}
\newtheorem{exam}{Example}
\newtheorem{rema}{Remark}[section]
\newtheorem{construction}{Construction}[section]
\newtheorem{prob}{Problem}[section]
\newtheorem{ques}{Question}
\newtheorem{exe}{Exercise}
\newcommand{\Np}{\mathbb{N^*}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\pr}{\textnormal{P}}
\newcommand{\E}{\textnormal{E}}
\renewcommand{\baselinestretch}{1.3}
\newcommand{\parallelsum}{\mathbin{\!/\mkern-5mu/\!}}
\newcommand{\B}{\hfill$\qedsymbol$}
\usepackage{centernot}
\usepackage{indentfirst}
\usepackage{setspace}
\usepackage[shortlabels]{enumitem}
%\setlist{leftmargin=5mm}
%Tạo frame
\usepackage[most]{tcolorbox}
%\renewcommand\familydefault{\sfdefault}
%san - mathversion
%\DeclareMathVersion{sans}
%\SetSymbolFont{operators}{sans}{OT1}{cmbr}{m}{n}
%\SetSymbolFont{letters}{sans}{OML}{cmbrm}{m}{it}
%\SetSymbolFont{symbols}{sans}{OMS}{cmbrs}{m}{n}
%\SetMathAlphabet{\mathit}{sans}{OT1}{cmbr}{m}{sl}
%\SetMathAlphabet{\mathbf}{sans}{OT1}{cmbr}{bx}{n}
%\SetMathAlphabet{\mathtt}{sans}{OT1}{cmtl}{m}{n}
%\SetSymbolFont{largesymbols}{sans}{OMX}{iwona}{m}{n}
%\sffamily\mathversion{sans}
\newtcolorbox[auto counter]{problem}[1][]{%
enhanced,
breakable,
colback=white,
colbacktitle=white,
coltitle=black,
fonttitle=\bfseries,
boxrule=1.25pt,
titlerule=.2pt,
toptitle=3pt,
bottomtitle=3pt,
title=Problem~\thetcbcounter,
#1}
\newtcolorbox[auto counter]{activity}[1][]{%
enhanced,
breakable,
colback=white,
colbacktitle=white,
coltitle=black,
fonttitle=\bfseries,
boxrule=1.25pt,
titlerule=.2pt,
toptitle=3pt,
bottomtitle=3pt,
title=Activity~\thetcbcounter,
#1}
\usepackage{fancyhdr,lipsum}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{fancy}
\fancypagestyle{plain}{%
\renewcommand{\headrulewidth}{0pt}%
\fancyhf{}%
}
\renewcommand{\chaptermark}[1]{%
\markboth{\bfseries\chaptername
\ \thechapter.\ #1}{}}
\fancyhead[R]{\bf \thepage}
\fancyhead[L]{\leftmark}
\fancyfoot{}
\usepackage{titlesec}
\titleformat{\chapter}[display]
{\bfseries\huge}
{\filright\huge\chaptertitlename~\thechapter}
{0.5cm}
{\titlerule[2.5pt]\vspace{0.1cm}\filright}
[{\vspace{0.1cm}\titlerule[2.5pt]}]
\begin{document}
\chapter{chapter 1}
\section{section 1}
\newpage
\chapter{chapter 2}
\end{document}
结果如下
我怎样才能将第 1 章、其标题和章节标题的颜色改为,blue
但仍保留其上下两条水平线?我尝试了命令\chapterfont{\color{blue}}
,但两条线会消失。我是新手\LaTeX
,所以请帮助我。非常感谢。