\usepackage{thmtools}
\usepackage[svgnames]{xcolor}
\usepackage{framed}

\colorlet{definitioncolor}{DarkGreen}
\colorlet{theoremcolor}{DarkBlue}

\renewenvironment{leftbar}[1][]{%
  \def\FrameCommand{{\color{#1}\vrule width 2pt} \hspace{7pt}}%
  \MakeFramed {\advance\hsize-\width \FrameRestore}}%
 {\endMakeFramed}

\renewenvironment{definitionbar}
  {\begin{leftbar}[definitioncolor]}
  {\end{leftbar}}

\renewenvironment{theorembar}
  {\begin{leftbar}[theoremcolor]}
  {\end{leftbar}}

\declaretheoremstyle[
  headfont=\sffamily\bfseries,%
  notefont=\sffamily\bfseries,%
  notebraces={(}{)},%
  headpunct=,%
  bodyfont=\sffamily\itshape,%
  headformat=\color{definitioncolor}\NAME~\NUMBER~\NOTE\hfill\smallskip\linebreak,%
  preheadhook=\begin{definitionbar},%
  postfoothook=\end{definitionbar},%
]{customDefinition}
\declaretheorem[name={Определение}, style=customDefinition]{definition}

\declaretheoremstyle[
  headfont=\bfseries,%
  notefont=\bfseries,%
  notebraces={(}{)},%
  headpunct=,%
  headformat=\color{theoremcolor}\NAME~\NUMBER~\NOTE\hfill\smallskip\linebreak,%
  preheadhook=\begin{theorembar},%
  postfoothook=\end{theorembar},%
]{customTheorem}
\declaretheorem[name={Теорема}, style=customTheorem]{theorem}

\declaretheoremstyle[
  headfont=\itshape\bfseries,%
  headpunct=,%
  headformat=\color{theoremcolor}\NAME\hfill\smallskip\linebreak,%
  preheadhook=\begin{theorembar},%
  postfoothook=\end{theorembar},%
]{customProof}
\declaretheorem[name={Доказательство}, style=customProof, unnumbered]{proofthm}
\renewenvironment{proof}{
  \begin{proofthm}
}{\end{proofthm}}

% TODO: Изменить стиль замечаний
\declaretheorem[name={Замечание}, style=definition, numberwithin=theorem]{remark}

\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5\baselineskip}

\hypersetup{
  colorlinks=true,
  linkcolor=blue,
}
