Barely three months after taking over Drug Fair Inc., Cleveland-based Gray Drug Stores Inc. has agreed in principle to a merger in which it would be acquired by Sherwin-Williams Co. for $55 million.

The agreement calls for a cash deal in which the giant paint and chemicals manufacturer would pay $21 each for all of the more than 2.6 million shares of Gray common stock outstanding.

Sherwin-Williams, which also is based in Cleveland, will initiate a tender offer for the Gray shares shortly after directors of both companies approve a definitive agreement.

With yesterday's announcement of the merger plans, Sherwin-Williams has emerged as a "white knight" by coming to the rescue of Gray, which is locked in a legal battle to fend off an attempt by National City Lines of Dallas to acquire 25 percent of the drug chain's stock.

"I guess you can use that terminology," said Jerome A. Weinberger, Gray's chairman and chief executive officer, when asked about Sherwin-Williams' role.

However, Weinberger described the proposed marriage of the two companies as a "logical merger" that "serves the best interests of Gray's shareholders".

Although Sherwin-Williams operates more than 1,400 retail stores, its business mix includes no operations associated with the chain-drug industry.

However, Gray Drug "fits a large segment of our core business in terms of distribution, store management and merchandising," said John G. Breen, Sherwin-Williams' chairman, in a brief statement.

The proposed merger "marks the beginning steps of our diversifying the company into areas we feel comfortable about managing and where we feel we have opportunities," Breen continued. Moreover, the specialty drugstore chain market is growing faster than the paint industry, he said.

Nonetheless, it was Gray that initiated merger discussions with Sherwin-Williams, Weinberger confirmed in a telephone interview yesterday.

With National City Lines, principally owned by Contran Corp. of Dallas, a private holding company, bidding to acquire 25 percent of the drug chain, Gray, which opposed that move, sought a more acceptable partner. "We had some talks with Sherwin-Williams, they did a study on their own and came up with the conclusion that they wanted to make a tender," Weinberger explained.

Meanwhile, National City said it will waive as a condition to its offer that a minimum 300,000 shares of Gray stock be tendered and not withdrawn prior to Monday's midnight deadline. NCL said it will await a resolution of conflicting court orders affecting its bid for Gray's stock.

On Monday, a federal judge in Ohio denied a motion by Gray for a preliminary injunction against NCL. At the same time, a lower court sustained its earlier order upholding the need for a hearing under Ohio laws on NCL's purchase offer.

Gray acquired the Drug Fair chain, of Alexandria, in May for about $34 million, or $20 a share -- more than twice the $9-a-share price at which Drug Fair was trading before the acquisition.

Former Drug Fair stockholders who sold their shares to Gray stand to gain considerably more on their original holdings. In trading on the New York Stock Exchange yesterday, Gray jumped 3 7/8 points, to close at 20 3/4.

Sherwin-Williams, on the other hand, fell 1 1/2 to 17 5/8.

After selling its Rink's discount department store operation in April, Gray operates about 360 drugstores, including the Drug Fair units.