\documentclass{article}
\usepackage{keyval,xcolor}
\usepackage{xepersian}
\makeatletter
\define@key{mydefinitionbox}{width}{\def\@mydefinitionboxwidth{#1}}
\define@key{mydefinitionbox}{theorem name}{\def\@mytheoremname{#1}}
\define@key{mydefinitionbox}{background color}{\def\@mybackgroundcolor{#1}}
\define@key{mydefinitionbox}{rule color}{\def\@myrulecolor{#1}}
\define@key{mydefinitionbox}{rule width}{\def\@myfboxrulewidth{#1}}
\define@key{mydefinitionbox}{paragraph indentation}{\def\@myparagraphindentation{#1}}
\newsavebox\mydefinitionbox
\@definecounter{mydefinition}
\newenvironment{definition}[1][]{%
\setkeys{mydefinitionbox}{width=\textwidth,theorem name={},background color=white,rule color=black,rule width=0.4pt,paragraph indentation=0cm,
#1}
\setlength{\fboxrule}{\@myfboxrulewidth}%
\begin{lrbox}{\mydefinitionbox}%
\begin{minipage}{\dimexpr(\@mydefinitionboxwidth-2\fboxsep-2\fboxrule)}%
%\setlength{\parindent}{\@myparagraphindentation}
%\refstepcounter{mydefinition}%
%\setlength{\fboxrule}{0.4pt}%
%\fbox{\themydefinition}
\textbf{\@mytheoremname}
}{%
\end{minipage}%
\end{lrbox}%
\vskip5pt\fboxsep=2mm
\noindent\fcolorbox{\@myrulecolor}{\@mybackgroundcolor}{\usebox\mydefinitionbox}%
\vskip5pt}
\makeatother
\begin{document}
این یک متن آزمایشی است که در حال نوشتنش هستیم این یک متن آزمایشی است که در حال نوشتنش هستیم این یک متن آزمایشی است که در حال نوشتنش هستیم 


\begin{center}
\begin{definition}[width=0.9\textwidth,background color=gray!20, rule color=black,rule width=2pt]
می‌گوئیم حد دنباله
\[\lim_{n\to\infty}a_n=L\]
این یک متن آزمایشی است که در حال نوشتنش هستیم این یک متن آزمایشی است که در حال نوشتنش هستیم این یک متن آزمایشی است که در حال نوشتنش هستیماین یک متن آزمایشی است که در حال نوشتنش هستیم این یک متن آزمایشی است که در حال نوشتنش هستیم این یک متن آزمایشی است که در حال نوشتنش هستیم
\end{definition}
\end{center}
\end{document}
