\documentclass{article}
\usepackage{xcolor}
% \def\costumcol#1{.....}
\begin{document}
sample text sample text sample text sample text sample text
sample text sample text sample text \costumcol{red} sample text
sample text sample text sample text sample text sample text
\hsize=.8\textwidth
sample text sample text sample text sample text sample text
sample text sample text sample text \costumcol{red} sample text
sample text sample text sample text sample text sample text
\end{document}
答案1
这实际上并不是颜色包的设计目的,并且也不是完全健全,但是......
\documentclass{article}
\usepackage{xcolor}
\makeatletter
\def\costumcol#1{{\let\aftergroup\@gobble\color{#1}}\vadjust{\reset@color}}
\makeatother
\begin{document}
sample text sample text sample text sample text sample text
sample text sample text sample text \costumcol{red} sample text
sample text sample text sample text sample text sample text
\hsize=.8\textwidth
sample text sample text sample text sample text sample text
sample text sample text sample text \costumcol{red} sample text
sample text sample text sample text sample text sample text
\end{document}