In this paper, the definition of three-dimensional generalized discrete fuzzy number (3-GDFN) is introduced based on the representation theorem of one-dimensional discrete fuzzy number and the similarity measure definition of two 3-GDFNs is given. Then the concept above mentioned is applied to color image representation and color mathematical morphology (CMM) in RGB space. The basic morphology operators, erosion and dilation, are extended to the CMM by defining the total preorder relation based on similarity measure between two 3-GDFNs instead of general vector sorting methods. The corresponding structuring elements in CMM are variable. Finally, the effectiveness and potential of the theoretical results are verified by comparative experiments. The proposed CMM operators are efficiently used in color image processing.